求有文字和链接地址的弹出窗口的网页代码
求有文字和链接地址的弹出窗口的网页代码:校园网站要求主页要求有一个能弹出有文字信息提示的如”欢迎浏览评估网站”的窗口,带链接地址点击能打开新的页面http://www2....
求有文字和链接地址的弹出窗口的网页代码:
校园网站要求主页要求有一个能弹出有文字信息提示的如”欢迎浏览评估网站”的窗口,带链接地址点击能打开新的页面http://www2.hist.edu.cn/pj/
可参考:http://www.hpu.edu.cn/hpu.asp
求各位高手相助!不甚感激!
拜托了,请按照我的要求给我具体的回答好吗? 展开
校园网站要求主页要求有一个能弹出有文字信息提示的如”欢迎浏览评估网站”的窗口,带链接地址点击能打开新的页面http://www2.hist.edu.cn/pj/
可参考:http://www.hpu.edu.cn/hpu.asp
求各位高手相助!不甚感激!
拜托了,请按照我的要求给我具体的回答好吗? 展开
展开全部
<?xml version="1.0" encoding="gb2312"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>互动力量免费留言本</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../css/template3.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../js/editor.js"></script>
<SCRIPT language="JavaScript">
<!--
if (top.location != self.location)top.location=self.location;
// -->
</SCRIPT>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url("../../images/template/3/bg.jpg");
}
</style>
<script language="JavaScript" src="../../js/common.js"></script>
<script language="JavaScript" src="../../js/ubbcode.js"></script>
<script language="JavaScript">
function formCheck()
{
AttachSubmit();
if (document.theform.nickname.value == "")
{
alert("请填写名字。");
document.theform.nickname.focus();
return false;
}
if (document.theform.content.value == "")
{
alert("请填写留言内容。");
//document.theform.content.focus();
return false;
}
if (document.theform.GetCode.value == "")
{
alert("请填写验证码。");
document.theform.GetCode.focus();
return false;
}
//document.theform.SubmitBtn.disabled=true;
return true;
}
function CheckUploadCount()
{
if (document.theform.upload_file_count.value >= 1)
{alert("每篇留言最多只能上传1个附件,现已达到上限。");}
else
{AP_popwin('upload.asp?userid=111433',4,400,80);}
}
function showimage()
{
document.images.faceimg.src=face_image[parseInt(document.theform.face.options[document.theform.face.selectedIndex].value)];
}
face_image=new Array(16);
face_image[0]="../../images/m01.gif";
face_image[1]="../../images/m02.gif";
face_image[2]="../../images/m03.gif";
face_image[3]="../../images/m04.gif";
face_image[4]="../../images/m05.gif";
face_image[5]="../../images/m06.gif";
face_image[6]="../../images/m07.gif";
face_image[7]="../../images/m08.gif";
face_image[8]="../../images/m09.gif";
face_image[9]="../../images/m10.gif";
face_image[10]="../../images/m11.gif";
face_image[11]="../../images/m12.gif";
face_image[12]="../../images/m13.gif";
face_image[13]="../../images/m14.gif";
face_image[14]="../../images/m15.gif";
face_image[15]="../../images/m16.gif";
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="../../images/template/3/top.jpg">
<tr>
<td width="1"><img src="../../images/blank.gif" width="1" height="101" /></td>
<td><table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td><img src="../../images/blank.gif" width="16" height="1" /></td>
<td><center>
<IFRAME marginHeight=0 marginWidth=0 noResize scrolling=no frameBorder=0 src="http://ads.activepower.net/script/ad/ad_show.asp?group_id=8&bgcolor=ffffff" width=468 height=60>
</IFRAME>
</center>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<table width="775" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="241"><img src="../../images/template/3/post_left.jpg" width="241" height="358" /></td>
<td background="../../images/template/3/post_right.jpg">
<form name="theform" onsubmit="return formCheck();" method="post" action="get_post.asp">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="19%"><font color="#FFFFFF"><strong>*</strong></font><img src="../../images/template/3/getbook_cooltext01.gif" width="64" height="20" align="absmiddle" /></td>
<td width="81%">
<input name="nickname" type="text" value="张添议" size="14" maxlength="12" />
</td>
</tr>
<tr>
<td><img src="../../images/template/3/getbook_cooltext02.gif" width="64" height="23" /></td>
<td><input name="email" type="text" id="email" size="14" /></td>
</tr>
<tr>
<td><img src="../../images/template/3/getbook_cooltext03.gif" width="64" height="27" /></td>
<td><input name="hp_url" type="text" id="hp_url" size="14" /></td>
</tr>
<tr>
<td colspan="2"><table width="98%" border="0" align="center" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF" style="border:1px solid #666666">
<tr>
<td colspan="2" class="Blackpt9">
<style type=text/css>
.outcolor{
border:1 double;border-color:#dddddd #dddddd #dddddd #dddddd;cursor:pointer;background:efefef
}
.overcolor{
border:1 double;border-color:#ffffff #999999 #999999 #ffffff;cursor:pointer;background:dddddd
}
.clickcolor{
border:1 double;border-color:#999999 #ffffff #ffffff #999999;cursor:pointer;background:dddddd
}
.StatusBarBtnOff {BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; HEIGHT: 18px; BACKGROUND-COLOR: #ffffff}
.StatusBarBtnOn {BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; HEIGHT: 18px; BACKGROUND-COLOR: #9BD7FF}
.baw{filter:Gray}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>
<img src="../../images/editor/bold.gif" alt="粗体" width="16" height="16" align="absmiddle" class="outcolor" style="cursor: pointer;" onClick="FormatText('bold', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)"> <img src="../../images/editor/italic.gif" alt="斜体" width="16" height="16" align="absmiddle" class="outcolor" style="cursor: pointer;" onClick="FormatText('italic', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)"> <img src="../../images/editor/underline.gif" alt="下划线" width="16" height="16" align="absmiddle" class=outcolor style="cursor: pointer;" onClick="FormatText('underline', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)">
<img src="../../images/editor/justifycenter.gif" alt="居中" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor: pointer;" onClick="FormatText('JustifyCenter', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)"> <img src="../../images/editor/createlink.gif" alt="插入超级链接" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor: pointer;" onClick="InsertURL()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)">
<img src="../../images/editor/separator.gif" align="absmiddle">
<img src="../../images/editor/insertimage.gif" alt="插入网上图片,支持格式为:gif、jpg、png、bmp" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor:pointer;" onClick="InsertPIC(111433)" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<img src="../../images/editor/paint.gif" alt="涂鸦板" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor:pointer;" onClick="InsertPaint(111433)" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<img src="../../images/editor/swf.gif" width="16" height="16" align="absmiddle" alt="插入Flash" class=outcolor style="cursor:pointer;" onClick="InsertSWF()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/wmv.gif" width="16" height="16" align="absmiddle" alt="插入Windows Media" class=outcolor style="cursor:pointer;" onClick="InsertWMV()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/rm.gif" width="16" height="16" align="absmiddle" alt="插入Real Media" class=outcolor style="cursor:pointer;" onClick="InsertRM()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<img src="../../images/editor/separator.gif" align="absmiddle">
<img src="../../images/editor/table.gif" alt="插入表格" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor:pointer;" onClick="TableInsert()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/insertrow.gif" width="16" height="16" align="absmiddle" alt="插入行" class=outcolor style="cursor:pointer;" onClick="TableRowInsertBelow()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/deleterow.gif" width="16" height="16" align="absmiddle" alt="删除行" class=outcolor style="cursor:pointer;" onClick="TableRowDelete()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/insertcolumn.gif" width="16" height="16" align="absmiddle" alt="插入列" class=outcolor style="cursor:pointer;" onClick="TableColInsertRight()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/deletecolumn.gif" width="16" height="16" align="absmiddle" alt="删除列" class=outcolor style="cursor:pointer;" onClick="TableColDelete()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<br>
<select id="selectFont" name="selectFont" onChange="FormatText('fontname', selectFont.options[selectFont.selectedIndex].value);" style="font-family: 宋体; font-size: 9pt" onmouseover="window.status='选择选定文字的字体。';return true;" onmouseout="window.status='';return true;">
<option selected>选择字体</option>
<option value="custom">自定义字体</option>
<option value="removeFormat">默认字体</option>
<option value="宋体">宋体</option>
<option value="黑体">黑体</option>
<option value="隶书">隶书</option>
<option value="幼圆">幼圆</option>
<option value="楷体_GB2312">楷体</option>
<option value="仿宋_GB2312">仿宋</option>
<option value="新宋体">新宋体</option>
<option value="华文彩云">华文彩云</option>
<option value="华文仿宋">华文仿宋</option>
<option value="华文新魏">华文新魏</option>
<option value="Arial">Arial</option>
<option value="Arial Black">Arial Black</option>
<option value="Arial Narrow">Arial Narrow</option>
<option value="Century">Century</option>
<option value="Courier New">Courier New</option>
<option value="Georgia">Georgia</option>
<option value="Impact">Impact</option>
<option value="Lucida Console">Lucida Console</option>
<option value="MS Sans Serif">MS Sans Serif</option>
<option value="System">System</option>
<option value="Symbol">Symbol</option>
<option value="Tahoma">Tahoma</option>
<option value="Times New Roman">Times New Roman</option>
<option value="Verdana">Verdana</option>
<option value="Webdings">Webdings</option>
<option value="Wingdings">Wingdings</option>
</select>
<select language="javascript" id="FontSize" name="FontSize" title="字号大小" onChange="FormatText('fontsize',this[this.selectedIndex].value);" onmouseover="window.status='选择选定文字的字号大小。';return true;" onmouseout="window.status='';return true;">
<option class="heading" selected>字号</option>
<option value="1">一号</option>
<option value="2">二号</option>
<option value="3">三号</option>
<option value="4">四号</option>
<option value="5">五号</option>
<option value="6">六号</option>
<option value="7">七号</option>
</select>
<select id="formatSelect" name="formatSelect" onChange="FormatText('FormatBlock',this[this.selectedIndex].value);">
<option selected>段落格式</option>
<option value="<P>">普通</option>
<option value="<PRE>">已编排格式</option>
<option value="<H1>">标题一</option>
<option value="<H2>">标题二</option>
<option value="<H3>">标题三</option>
<option value="<H4>">标题四</option>
<option value="<H5>">标题五</option>
<option value="<H6>">标题六</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="72%" align="center">
<table width="98%">
<tr id="CodeMode" style="display:none;">
<td style="border:1px solid #cccccc" width="100%">
<textarea id="HtmlEditorContent" name="HtmlEditorContent" style="padding:6px; font-size:14px; WIDTH: 100%; HEIGHT: 200px"></textarea>
</td>
</tr>
<tr id="DesignMode">
<td style="border:1px solid #cccccc" width="100%">
<iframe id="HtmlEditor" name="HtmlEditor" MARGINHEIGHT="6" MARGINWIDTH="6" width="100%" height="200" frameborder="0" scrolling="yes"></iframe>
</td>
</tr>
<tr style="display:none;">
<td>
<img src="../../images/editor/editor.gif" align="absmiddle" id="HtmlDesign">
<img src="../../images/editor/html.gif" align="absmiddle" id="HtmlCode">
<img src="../../images/editor/browse.gif" align="absmiddle" id="HtmlView">
<textarea name="content" id="content" style="VISIBILITY: hidden; OVERFLOW: hidden; POSITION: absolute; WIDTH: 1px; HEIGHT: 1px"></textarea>
<div id="HtmlEditor_Temp_HTML" style="VISIBILITY: hidden; OVERFLOW: hidden; POSITION: absolute; WIDTH: 1px; HEIGHT: 1px"></div>
<input type="hidden" ID="ContentEdit" name="ContentEdit" value="">
<input type="hidden" ID="ModeEdit" name="ModeEdit" value="">
<input type="hidden" ID="ContentLoad" name="ContentLoad" value="">
<input type="hidden" ID="ContentFlag" name="ContentFlag" value="0">
<script language=javascript> HtmlEditor_Initialized() ; </script>
</td>
</tr>
</table>
</td>
<td width="28%" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td align="center"><font color="#000000">选择头像</font></td>
</tr>
<tr>
<td align="center"><select size="1" name="face" onchange="showimage()">
<option value="0" selected>好开心</option>
<option value="1">
好难过</option>
<option value="2">
好伤心</option>
<option value="3">
要唱歌</option>
<option value="4">
正哭泣</option>
<option value="5">
很满意</option>
<option value="6">
很惊喜</option>
<option value="7">
好生气</option>
<option value="8">
好害怕</option>
<option value="9">
真倒霉</option>
<option value="10">
扁着嘴</option>
<option value="11">
平常心</option>
<option value="12">
冒冷汗</option>
<option value="13">
伤脑筋</option>
<option value="14">
笑死了</option>
<option value="15">
好气愤</option>
</select>
</td>
</tr>
<tr>
<td align="center"><table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="6"><img src="../../images/box10_tl.gif" width="6" height="5" /></td>
<td background="../../images/box10_tbg.gif"><img src="../../images/box10_tbg.gif" width="6" height="5" /></td>
<td width="6"><img src="../../images/box10_tr.gif" width="6" height="5" /></td>
</tr>
<tr>
<td width="6" background="../../images/box10_lbg.gif"><img src="../../images/box10_lbg.gif" width="6" height="5" /></td>
<td bgcolor="#FFFFFF"><p><img src="../../images/m01.gif" name="faceimg" id="faceimg" /></p>
</td>
<td width="6" background="../../images/box10_rbg.gif"><img src="../../images/box10_rbg.gif" width="6" height="5" /></td>
</tr>
<tr>
<td width="6"><img src="../../images/box10_bl.gif" width="6" height="5" /></td>
<td background="../../images/box10_bbg.gif"><img src="../../images/box10_bbg.gif" width="6" height="5" /></td>
<td width="6"><img src="../../images/box10_br.gif" width="6" height="5" /></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%"><img src="../../images/template/3/getbook_cooltext08.gif" width="97" height="22" /></td>
<td width="9%"><input name="GetCode" type="text" id="GetCode" size="4" maxlength="4" /></td>
<td width="17%"><img src="" width="72" height="18" id="GetCodeImg" /></td>
<td width="56%"><input name="SubmitBtn" id="SubmitBtn" type="image" src="../../images/template/3/button.GIF" border="0" />
<input name="replyer" type="hidden" value="" />
<input name="reply_content_id" type="hidden" value="" />
<input name="userid" type="hidden" value="111433" />
<input type="hidden" name="sum_upload_file_size" value="0" />
<input type="hidden" name="upload_files" value="" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>互动力量免费留言本</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../css/template3.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../js/editor.js"></script>
<SCRIPT language="JavaScript">
<!--
if (top.location != self.location)top.location=self.location;
// -->
</SCRIPT>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url("../../images/template/3/bg.jpg");
}
</style>
<script language="JavaScript" src="../../js/common.js"></script>
<script language="JavaScript" src="../../js/ubbcode.js"></script>
<script language="JavaScript">
function formCheck()
{
AttachSubmit();
if (document.theform.nickname.value == "")
{
alert("请填写名字。");
document.theform.nickname.focus();
return false;
}
if (document.theform.content.value == "")
{
alert("请填写留言内容。");
//document.theform.content.focus();
return false;
}
if (document.theform.GetCode.value == "")
{
alert("请填写验证码。");
document.theform.GetCode.focus();
return false;
}
//document.theform.SubmitBtn.disabled=true;
return true;
}
function CheckUploadCount()
{
if (document.theform.upload_file_count.value >= 1)
{alert("每篇留言最多只能上传1个附件,现已达到上限。");}
else
{AP_popwin('upload.asp?userid=111433',4,400,80);}
}
function showimage()
{
document.images.faceimg.src=face_image[parseInt(document.theform.face.options[document.theform.face.selectedIndex].value)];
}
face_image=new Array(16);
face_image[0]="../../images/m01.gif";
face_image[1]="../../images/m02.gif";
face_image[2]="../../images/m03.gif";
face_image[3]="../../images/m04.gif";
face_image[4]="../../images/m05.gif";
face_image[5]="../../images/m06.gif";
face_image[6]="../../images/m07.gif";
face_image[7]="../../images/m08.gif";
face_image[8]="../../images/m09.gif";
face_image[9]="../../images/m10.gif";
face_image[10]="../../images/m11.gif";
face_image[11]="../../images/m12.gif";
face_image[12]="../../images/m13.gif";
face_image[13]="../../images/m14.gif";
face_image[14]="../../images/m15.gif";
face_image[15]="../../images/m16.gif";
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="../../images/template/3/top.jpg">
<tr>
<td width="1"><img src="../../images/blank.gif" width="1" height="101" /></td>
<td><table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td><img src="../../images/blank.gif" width="16" height="1" /></td>
<td><center>
<IFRAME marginHeight=0 marginWidth=0 noResize scrolling=no frameBorder=0 src="http://ads.activepower.net/script/ad/ad_show.asp?group_id=8&bgcolor=ffffff" width=468 height=60>
</IFRAME>
</center>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<table width="775" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="241"><img src="../../images/template/3/post_left.jpg" width="241" height="358" /></td>
<td background="../../images/template/3/post_right.jpg">
<form name="theform" onsubmit="return formCheck();" method="post" action="get_post.asp">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="19%"><font color="#FFFFFF"><strong>*</strong></font><img src="../../images/template/3/getbook_cooltext01.gif" width="64" height="20" align="absmiddle" /></td>
<td width="81%">
<input name="nickname" type="text" value="张添议" size="14" maxlength="12" />
</td>
</tr>
<tr>
<td><img src="../../images/template/3/getbook_cooltext02.gif" width="64" height="23" /></td>
<td><input name="email" type="text" id="email" size="14" /></td>
</tr>
<tr>
<td><img src="../../images/template/3/getbook_cooltext03.gif" width="64" height="27" /></td>
<td><input name="hp_url" type="text" id="hp_url" size="14" /></td>
</tr>
<tr>
<td colspan="2"><table width="98%" border="0" align="center" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF" style="border:1px solid #666666">
<tr>
<td colspan="2" class="Blackpt9">
<style type=text/css>
.outcolor{
border:1 double;border-color:#dddddd #dddddd #dddddd #dddddd;cursor:pointer;background:efefef
}
.overcolor{
border:1 double;border-color:#ffffff #999999 #999999 #ffffff;cursor:pointer;background:dddddd
}
.clickcolor{
border:1 double;border-color:#999999 #ffffff #ffffff #999999;cursor:pointer;background:dddddd
}
.StatusBarBtnOff {BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; HEIGHT: 18px; BACKGROUND-COLOR: #ffffff}
.StatusBarBtnOn {BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; HEIGHT: 18px; BACKGROUND-COLOR: #9BD7FF}
.baw{filter:Gray}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>
<img src="../../images/editor/bold.gif" alt="粗体" width="16" height="16" align="absmiddle" class="outcolor" style="cursor: pointer;" onClick="FormatText('bold', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)"> <img src="../../images/editor/italic.gif" alt="斜体" width="16" height="16" align="absmiddle" class="outcolor" style="cursor: pointer;" onClick="FormatText('italic', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)"> <img src="../../images/editor/underline.gif" alt="下划线" width="16" height="16" align="absmiddle" class=outcolor style="cursor: pointer;" onClick="FormatText('underline', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)">
<img src="../../images/editor/justifycenter.gif" alt="居中" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor: pointer;" onClick="FormatText('JustifyCenter', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)"> <img src="../../images/editor/createlink.gif" alt="插入超级链接" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor: pointer;" onClick="InsertURL()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)">
<img src="../../images/editor/separator.gif" align="absmiddle">
<img src="../../images/editor/insertimage.gif" alt="插入网上图片,支持格式为:gif、jpg、png、bmp" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor:pointer;" onClick="InsertPIC(111433)" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<img src="../../images/editor/paint.gif" alt="涂鸦板" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor:pointer;" onClick="InsertPaint(111433)" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<img src="../../images/editor/swf.gif" width="16" height="16" align="absmiddle" alt="插入Flash" class=outcolor style="cursor:pointer;" onClick="InsertSWF()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/wmv.gif" width="16" height="16" align="absmiddle" alt="插入Windows Media" class=outcolor style="cursor:pointer;" onClick="InsertWMV()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/rm.gif" width="16" height="16" align="absmiddle" alt="插入Real Media" class=outcolor style="cursor:pointer;" onClick="InsertRM()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<img src="../../images/editor/separator.gif" align="absmiddle">
<img src="../../images/editor/table.gif" alt="插入表格" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor:pointer;" onClick="TableInsert()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/insertrow.gif" width="16" height="16" align="absmiddle" alt="插入行" class=outcolor style="cursor:pointer;" onClick="TableRowInsertBelow()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/deleterow.gif" width="16" height="16" align="absmiddle" alt="删除行" class=outcolor style="cursor:pointer;" onClick="TableRowDelete()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/insertcolumn.gif" width="16" height="16" align="absmiddle" alt="插入列" class=outcolor style="cursor:pointer;" onClick="TableColInsertRight()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/deletecolumn.gif" width="16" height="16" align="absmiddle" alt="删除列" class=outcolor style="cursor:pointer;" onClick="TableColDelete()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<br>
<select id="selectFont" name="selectFont" onChange="FormatText('fontname', selectFont.options[selectFont.selectedIndex].value);" style="font-family: 宋体; font-size: 9pt" onmouseover="window.status='选择选定文字的字体。';return true;" onmouseout="window.status='';return true;">
<option selected>选择字体</option>
<option value="custom">自定义字体</option>
<option value="removeFormat">默认字体</option>
<option value="宋体">宋体</option>
<option value="黑体">黑体</option>
<option value="隶书">隶书</option>
<option value="幼圆">幼圆</option>
<option value="楷体_GB2312">楷体</option>
<option value="仿宋_GB2312">仿宋</option>
<option value="新宋体">新宋体</option>
<option value="华文彩云">华文彩云</option>
<option value="华文仿宋">华文仿宋</option>
<option value="华文新魏">华文新魏</option>
<option value="Arial">Arial</option>
<option value="Arial Black">Arial Black</option>
<option value="Arial Narrow">Arial Narrow</option>
<option value="Century">Century</option>
<option value="Courier New">Courier New</option>
<option value="Georgia">Georgia</option>
<option value="Impact">Impact</option>
<option value="Lucida Console">Lucida Console</option>
<option value="MS Sans Serif">MS Sans Serif</option>
<option value="System">System</option>
<option value="Symbol">Symbol</option>
<option value="Tahoma">Tahoma</option>
<option value="Times New Roman">Times New Roman</option>
<option value="Verdana">Verdana</option>
<option value="Webdings">Webdings</option>
<option value="Wingdings">Wingdings</option>
</select>
<select language="javascript" id="FontSize" name="FontSize" title="字号大小" onChange="FormatText('fontsize',this[this.selectedIndex].value);" onmouseover="window.status='选择选定文字的字号大小。';return true;" onmouseout="window.status='';return true;">
<option class="heading" selected>字号</option>
<option value="1">一号</option>
<option value="2">二号</option>
<option value="3">三号</option>
<option value="4">四号</option>
<option value="5">五号</option>
<option value="6">六号</option>
<option value="7">七号</option>
</select>
<select id="formatSelect" name="formatSelect" onChange="FormatText('FormatBlock',this[this.selectedIndex].value);">
<option selected>段落格式</option>
<option value="<P>">普通</option>
<option value="<PRE>">已编排格式</option>
<option value="<H1>">标题一</option>
<option value="<H2>">标题二</option>
<option value="<H3>">标题三</option>
<option value="<H4>">标题四</option>
<option value="<H5>">标题五</option>
<option value="<H6>">标题六</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="72%" align="center">
<table width="98%">
<tr id="CodeMode" style="display:none;">
<td style="border:1px solid #cccccc" width="100%">
<textarea id="HtmlEditorContent" name="HtmlEditorContent" style="padding:6px; font-size:14px; WIDTH: 100%; HEIGHT: 200px"></textarea>
</td>
</tr>
<tr id="DesignMode">
<td style="border:1px solid #cccccc" width="100%">
<iframe id="HtmlEditor" name="HtmlEditor" MARGINHEIGHT="6" MARGINWIDTH="6" width="100%" height="200" frameborder="0" scrolling="yes"></iframe>
</td>
</tr>
<tr style="display:none;">
<td>
<img src="../../images/editor/editor.gif" align="absmiddle" id="HtmlDesign">
<img src="../../images/editor/html.gif" align="absmiddle" id="HtmlCode">
<img src="../../images/editor/browse.gif" align="absmiddle" id="HtmlView">
<textarea name="content" id="content" style="VISIBILITY: hidden; OVERFLOW: hidden; POSITION: absolute; WIDTH: 1px; HEIGHT: 1px"></textarea>
<div id="HtmlEditor_Temp_HTML" style="VISIBILITY: hidden; OVERFLOW: hidden; POSITION: absolute; WIDTH: 1px; HEIGHT: 1px"></div>
<input type="hidden" ID="ContentEdit" name="ContentEdit" value="">
<input type="hidden" ID="ModeEdit" name="ModeEdit" value="">
<input type="hidden" ID="ContentLoad" name="ContentLoad" value="">
<input type="hidden" ID="ContentFlag" name="ContentFlag" value="0">
<script language=javascript> HtmlEditor_Initialized() ; </script>
</td>
</tr>
</table>
</td>
<td width="28%" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td align="center"><font color="#000000">选择头像</font></td>
</tr>
<tr>
<td align="center"><select size="1" name="face" onchange="showimage()">
<option value="0" selected>好开心</option>
<option value="1">
好难过</option>
<option value="2">
好伤心</option>
<option value="3">
要唱歌</option>
<option value="4">
正哭泣</option>
<option value="5">
很满意</option>
<option value="6">
很惊喜</option>
<option value="7">
好生气</option>
<option value="8">
好害怕</option>
<option value="9">
真倒霉</option>
<option value="10">
扁着嘴</option>
<option value="11">
平常心</option>
<option value="12">
冒冷汗</option>
<option value="13">
伤脑筋</option>
<option value="14">
笑死了</option>
<option value="15">
好气愤</option>
</select>
</td>
</tr>
<tr>
<td align="center"><table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="6"><img src="../../images/box10_tl.gif" width="6" height="5" /></td>
<td background="../../images/box10_tbg.gif"><img src="../../images/box10_tbg.gif" width="6" height="5" /></td>
<td width="6"><img src="../../images/box10_tr.gif" width="6" height="5" /></td>
</tr>
<tr>
<td width="6" background="../../images/box10_lbg.gif"><img src="../../images/box10_lbg.gif" width="6" height="5" /></td>
<td bgcolor="#FFFFFF"><p><img src="../../images/m01.gif" name="faceimg" id="faceimg" /></p>
</td>
<td width="6" background="../../images/box10_rbg.gif"><img src="../../images/box10_rbg.gif" width="6" height="5" /></td>
</tr>
<tr>
<td width="6"><img src="../../images/box10_bl.gif" width="6" height="5" /></td>
<td background="../../images/box10_bbg.gif"><img src="../../images/box10_bbg.gif" width="6" height="5" /></td>
<td width="6"><img src="../../images/box10_br.gif" width="6" height="5" /></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%"><img src="../../images/template/3/getbook_cooltext08.gif" width="97" height="22" /></td>
<td width="9%"><input name="GetCode" type="text" id="GetCode" size="4" maxlength="4" /></td>
<td width="17%"><img src="" width="72" height="18" id="GetCodeImg" /></td>
<td width="56%"><input name="SubmitBtn" id="SubmitBtn" type="image" src="../../images/template/3/button.GIF" border="0" />
<input name="replyer" type="hidden" value="" />
<input name="reply_content_id" type="hidden" value="" />
<input name="userid" type="hidden" value="111433" />
<input type="hidden" name="sum_upload_file_size" value="0" />
<input type="hidden" name="upload_files" value="" />
展开全部
其实代码非常简单:
<SCRIPT LANGUAGE="javascript">
<!--
window.open ('page.html')
-->
</SCRIPT>
因为这是一段javascript代码,所以它们应该放在<SCRIPT LANGUAGE ="javascript">标签和</script>之间。<!--和-->是对一些版本低的浏览器起作用,在这些老浏览器中如果不支持javascript,不会将标签中的代码作为文本显示出来。
Window.open ('page.html')用于控制弹出新的窗口page.html,如果page.html不与主窗口在同一路径下,前面应写明路径,绝对路径(http://)和相对路径(../)均可。
用单引号和双引号都可以,只是不要混用。
这一段代码可以加入HTML的任意位置,加入到<head>和</head>之间也可以,位置越靠前执行越早,尤其是页面代码较长时,又想使页面早点弹出就尽量往前放。
【经过设置后的弹出窗口】
下面再说一说弹出窗口外观的设置。只要再往上面的代码中加一点东西就可以了。
我们来定制这个弹出窗口的外观、尺寸大小、弹出位置以适应该页面的具体情况。
<SCRIPT LANGUAGE="javascript:>
<!--
window.open ('page.html','newwindow','height=100,width=400,top=0,left=0,toolbar=no,
menubar=no,scrollbars=no,resizable=no,
location=no,status=no')
//写成一行
-->
</SCRIPT>
参数解释:
<SCRIPT LANGUAGE="javascript"> js脚本开始;
window.open 弹出新窗口的命令;
page.html 弹出新窗口的文件名;
newwindow 弹出窗口的名字(不是文件名),可用空 〃代替;
height=100 窗口高度;
top=0 窗口距离屏幕上方的像素值;
left=0 窗口距离屏幕左侧的像素值;
toolbar=no 是否显示工具栏,yes为显示;
menubar,scrollbars 表示菜单栏和滚动栏;
resizable=no 是否允许改变窗口大小,yes为允许;
location=no 是否显示地址栏,yes为允许;
status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许;
</SCRIPT> js脚本结束。
【用函数控制弹出窗口】
下面是一个完整的代码。
<html>
<head>
<script LANGUAGE="javascript">
<!--
function openwin(){
window.open("http://www2.hist.edu.cn ","newwindow","height=100,width=400,toolbar=no,menubar=no,
scrollbars=no,resizable=no, location=no,status=no";)
//写成一行
}
-->
</script>
</head>
<body onload="openwin()">
...任意的页面内容...
</body>
</html>
这里定义了一个函数openwin(),函数内容就是打开一个窗口。在调用它之前没有任何用途。怎么调用呢?
方法一:<body onload="openwen()"> 浏览器读页面时弹出窗口;
方法二:<body onunload="openwen()"> 浏览器离开页面时弹出窗口;
方法三:用一个连接调用:<a href="#" onclick="openwin()">打开一个窗口</a>
注意:使用的"#"是虚连接。
方法四:用一个按钮调用:<input type="button" onclick="openwin()" value="打开窗口">
【主窗口打开文件1.htm,同时弹出小窗口page.html】
将如下代码加入主窗口<head>区:
<script language="javascript">
<!--
function openwin(){
window.open("page.html","","width=200,height=200" ;)
}
//-->
</script>
加入<body>区:<a href="1.htm" onclick="openwin()">open</a>即可。
【弹出的窗口之定时关闭控制】
下面我们再对弹出窗口进行一些控制,效果就更好了。如果我们再将一小段代码加入弹出的页面(注意是加入到page.html的HTML中,可不是主页面中,否则…),让它在10秒钟后自动关闭是不是更酷了?
首先,将如下代码加入page.html文件的<head>区:
<script language="javascript">
function closeit() {
setTimeout("self.close()",10000) //毫秒
}
</script>
然后,再用<body onload="closeit()">这一句话代替page.html中原有的<BODY>这一句就可以了。(这一句话千万不要忘记写啊!这一句的作用是调用关闭窗口的代码,10秒钟后就自行关闭该窗口。)
【在弹出窗口中加上一个关闭按钮】
<form>
<INPUT TYPE='BUTTON' value='关闭' onClick='window.close()'>
</form>
呵呵,现在更加完美了!
【内包含的弹出窗口——一个页面两个窗口】
上面的例子都包含两个窗口,一个是主窗口,另一个是弹出的小窗口。
通过下面的例子,你可以在一个页面内完成上面的效果。
<html>
<head>
<SCRIPT LANGUAGE="javascript">
function openwin()
{
OpenWindow=window.open("","newwin","height=250,width=250,toolbar=no,scrollbars="+scroll+",menubar=no";);
//写成一行
OpenWindow.document.write("<TITLE>例子</TITLE>" ;)
OpenWindow.document.write("<BODY BGCOLOR=#FFFFFF>" ;)
OpenWindow.document.write("<H1>Hello!</h1>" ;)
OpenWindow.document.write("New window opened!" ;)
OpenWindow.document.write("</BODY >" ;)
OpenWindow.document.write("</HTML>" ;)
OpenWindow.document.close()
}
</script>
</head>
<body>
<a href="#" onclick="openwin()">打开一个窗口</a>
<input type="button" onclick="openwin()" value="打开窗口">
</body>
</html>
看看OpenWindow.document.write()里面的代码不就是标准的HTML吗?只要按照格式写更多的行即可。千万注意多一个标签或少一个标签都会出现错误。记住用OpenWindow.document.close()结束啊。
【终极应用——弹出窗口的Cookie控制】
回想一下,上面的弹出窗口虽然酷,但是有一点小毛病(你沉浸在喜悦之中,一定没有发现吧?)比如你将上面的脚本放在一个需要频繁经过的页面里(例如首页),那么每次刷新这个页面,窗口都会弹出一次,是不是非常烦人?有解决的办法吗?Yes!Follow me。我们使用Cookie来控制一下就可以了。
首先,将如下代码加入主页面HTML的<HEAD>区:
<script>
function openwin(){
window.open("page.html","","width=200,height=200" ;)
}
function get_cookie(Name){
var search = Name+ "="
var returnvalue ="";
if (documents.cookie.length >0){
offset = documents.cookie.indexOf(search)
if (offset!=-1){
offset += search.length
end = documents.cookie.indexOf (";",offset);
if (end ==-1)
end = documents.cookie.length;
returnvalue =unescape(documents.cookie.substring(offset,end))
}
}
return returnvalue;
}
function loadpopup(){
if (get_cookie('popped')==";){
openwin()
documents.cookie="popped=yes"
}
}
</script>
然后,用<body onload="loadpopup()">(注意不是openwin 而是loadpop啊)替换主页面中原有的<BODY>这一句即可。你可以试着刷新一下这个页面或重新进入该页面,窗口再也不会弹出了。真正的Pop-Only-Once!
写到这里,弹出窗口的制作和应用技巧基本上算是讲完了,希望对正在制作网页的朋友有所帮助我就非常欣慰了。
需要注意的是,JS脚本中的大小写最好前后保持一致。
没有菜单、工具栏、地址栏的弹出窗口:
<script language="javascript">
<!--
var gt = unescape('%3e');
var popup = null;
var over = "Launch Pop-up Navigator";
popup = window.open('', 'popupnav', 'width=500,height=500,resizable=0,scrollbars=auto'); // width=500,height=500为窗口长和宽
if (popup != null) {
if (popup.opener == null) {
popup.opener = self; }
popup.location.href = '要打开的文件名';
}
// -->
</script>
冒昧的问下你是不是对编程一点都不懂?最直接的各种例子都已经给你拿出来,谁知道你的别的页或当前页的命名规则。你是不是想直接复制过去就能用啊?不可能你自己一点都不修改就能用。
<SCRIPT LANGUAGE="javascript">
<!--
window.open ('page.html')
-->
</SCRIPT>
因为这是一段javascript代码,所以它们应该放在<SCRIPT LANGUAGE ="javascript">标签和</script>之间。<!--和-->是对一些版本低的浏览器起作用,在这些老浏览器中如果不支持javascript,不会将标签中的代码作为文本显示出来。
Window.open ('page.html')用于控制弹出新的窗口page.html,如果page.html不与主窗口在同一路径下,前面应写明路径,绝对路径(http://)和相对路径(../)均可。
用单引号和双引号都可以,只是不要混用。
这一段代码可以加入HTML的任意位置,加入到<head>和</head>之间也可以,位置越靠前执行越早,尤其是页面代码较长时,又想使页面早点弹出就尽量往前放。
【经过设置后的弹出窗口】
下面再说一说弹出窗口外观的设置。只要再往上面的代码中加一点东西就可以了。
我们来定制这个弹出窗口的外观、尺寸大小、弹出位置以适应该页面的具体情况。
<SCRIPT LANGUAGE="javascript:>
<!--
window.open ('page.html','newwindow','height=100,width=400,top=0,left=0,toolbar=no,
menubar=no,scrollbars=no,resizable=no,
location=no,status=no')
//写成一行
-->
</SCRIPT>
参数解释:
<SCRIPT LANGUAGE="javascript"> js脚本开始;
window.open 弹出新窗口的命令;
page.html 弹出新窗口的文件名;
newwindow 弹出窗口的名字(不是文件名),可用空 〃代替;
height=100 窗口高度;
top=0 窗口距离屏幕上方的像素值;
left=0 窗口距离屏幕左侧的像素值;
toolbar=no 是否显示工具栏,yes为显示;
menubar,scrollbars 表示菜单栏和滚动栏;
resizable=no 是否允许改变窗口大小,yes为允许;
location=no 是否显示地址栏,yes为允许;
status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许;
</SCRIPT> js脚本结束。
【用函数控制弹出窗口】
下面是一个完整的代码。
<html>
<head>
<script LANGUAGE="javascript">
<!--
function openwin(){
window.open("http://www2.hist.edu.cn ","newwindow","height=100,width=400,toolbar=no,menubar=no,
scrollbars=no,resizable=no, location=no,status=no";)
//写成一行
}
-->
</script>
</head>
<body onload="openwin()">
...任意的页面内容...
</body>
</html>
这里定义了一个函数openwin(),函数内容就是打开一个窗口。在调用它之前没有任何用途。怎么调用呢?
方法一:<body onload="openwen()"> 浏览器读页面时弹出窗口;
方法二:<body onunload="openwen()"> 浏览器离开页面时弹出窗口;
方法三:用一个连接调用:<a href="#" onclick="openwin()">打开一个窗口</a>
注意:使用的"#"是虚连接。
方法四:用一个按钮调用:<input type="button" onclick="openwin()" value="打开窗口">
【主窗口打开文件1.htm,同时弹出小窗口page.html】
将如下代码加入主窗口<head>区:
<script language="javascript">
<!--
function openwin(){
window.open("page.html","","width=200,height=200" ;)
}
//-->
</script>
加入<body>区:<a href="1.htm" onclick="openwin()">open</a>即可。
【弹出的窗口之定时关闭控制】
下面我们再对弹出窗口进行一些控制,效果就更好了。如果我们再将一小段代码加入弹出的页面(注意是加入到page.html的HTML中,可不是主页面中,否则…),让它在10秒钟后自动关闭是不是更酷了?
首先,将如下代码加入page.html文件的<head>区:
<script language="javascript">
function closeit() {
setTimeout("self.close()",10000) //毫秒
}
</script>
然后,再用<body onload="closeit()">这一句话代替page.html中原有的<BODY>这一句就可以了。(这一句话千万不要忘记写啊!这一句的作用是调用关闭窗口的代码,10秒钟后就自行关闭该窗口。)
【在弹出窗口中加上一个关闭按钮】
<form>
<INPUT TYPE='BUTTON' value='关闭' onClick='window.close()'>
</form>
呵呵,现在更加完美了!
【内包含的弹出窗口——一个页面两个窗口】
上面的例子都包含两个窗口,一个是主窗口,另一个是弹出的小窗口。
通过下面的例子,你可以在一个页面内完成上面的效果。
<html>
<head>
<SCRIPT LANGUAGE="javascript">
function openwin()
{
OpenWindow=window.open("","newwin","height=250,width=250,toolbar=no,scrollbars="+scroll+",menubar=no";);
//写成一行
OpenWindow.document.write("<TITLE>例子</TITLE>" ;)
OpenWindow.document.write("<BODY BGCOLOR=#FFFFFF>" ;)
OpenWindow.document.write("<H1>Hello!</h1>" ;)
OpenWindow.document.write("New window opened!" ;)
OpenWindow.document.write("</BODY >" ;)
OpenWindow.document.write("</HTML>" ;)
OpenWindow.document.close()
}
</script>
</head>
<body>
<a href="#" onclick="openwin()">打开一个窗口</a>
<input type="button" onclick="openwin()" value="打开窗口">
</body>
</html>
看看OpenWindow.document.write()里面的代码不就是标准的HTML吗?只要按照格式写更多的行即可。千万注意多一个标签或少一个标签都会出现错误。记住用OpenWindow.document.close()结束啊。
【终极应用——弹出窗口的Cookie控制】
回想一下,上面的弹出窗口虽然酷,但是有一点小毛病(你沉浸在喜悦之中,一定没有发现吧?)比如你将上面的脚本放在一个需要频繁经过的页面里(例如首页),那么每次刷新这个页面,窗口都会弹出一次,是不是非常烦人?有解决的办法吗?Yes!Follow me。我们使用Cookie来控制一下就可以了。
首先,将如下代码加入主页面HTML的<HEAD>区:
<script>
function openwin(){
window.open("page.html","","width=200,height=200" ;)
}
function get_cookie(Name){
var search = Name+ "="
var returnvalue ="";
if (documents.cookie.length >0){
offset = documents.cookie.indexOf(search)
if (offset!=-1){
offset += search.length
end = documents.cookie.indexOf (";",offset);
if (end ==-1)
end = documents.cookie.length;
returnvalue =unescape(documents.cookie.substring(offset,end))
}
}
return returnvalue;
}
function loadpopup(){
if (get_cookie('popped')==";){
openwin()
documents.cookie="popped=yes"
}
}
</script>
然后,用<body onload="loadpopup()">(注意不是openwin 而是loadpop啊)替换主页面中原有的<BODY>这一句即可。你可以试着刷新一下这个页面或重新进入该页面,窗口再也不会弹出了。真正的Pop-Only-Once!
写到这里,弹出窗口的制作和应用技巧基本上算是讲完了,希望对正在制作网页的朋友有所帮助我就非常欣慰了。
需要注意的是,JS脚本中的大小写最好前后保持一致。
没有菜单、工具栏、地址栏的弹出窗口:
<script language="javascript">
<!--
var gt = unescape('%3e');
var popup = null;
var over = "Launch Pop-up Navigator";
popup = window.open('', 'popupnav', 'width=500,height=500,resizable=0,scrollbars=auto'); // width=500,height=500为窗口长和宽
if (popup != null) {
if (popup.opener == null) {
popup.opener = self; }
popup.location.href = '要打开的文件名';
}
// -->
</script>
冒昧的问下你是不是对编程一点都不懂?最直接的各种例子都已经给你拿出来,谁知道你的别的页或当前页的命名规则。你是不是想直接复制过去就能用啊?不可能你自己一点都不修改就能用。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询