网页制作精华问答集

1。问:在网页中JS打印按钮怎么做?

答:加入以下代码:
<script language="Javascript">
var NS = (navigator.appName == "Netscape");
var VERSION = parseInt(navigator.appVersion);
if (VERSION > 3) {
document.write(]]}<form><input type=button value="打印本页" name="Print" onClick="printit()"></form>]]});
}
</script>

2。在html中是否可包含其它文件,如何使用
使用内侦IFRAME (320字)(兰竹 9-4 11:07 阅读 26)

 

<CENTER> <IFRAME MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 HEIGHT=62 WIDTH=470 SCROLLING=NO SRC=http://www.51hz.com/bbs/></IFRAME> </CENTER>
3。谁知道怎么用JS关掉亿唐的广告?
这是JavaScript参考手册的原话:

You can use open on an existing window, and if you pass the empty string for the URL, you will get a reference to the existing window, but not load anything into it. You can, for example, then look for properties in the window.

所以我们只要用两句话就行了
newwindow=open(]]}]]},]]}etangWHpopup]]});
newwindow.close();
4。怎样锁右键,和解开右键?
锁右键: <script
language="JavaScript">
function Curdate()
{
var today=new Date();
yearStr=1900+today.getYear();
monthStr=today.getMonth()+1;
dateStr=today.getDate();
weekVal=today.getDay();
msg="每日综述("+yearStr+"年"+monthStr+"月"+
""+dateStr+"日)"
return msg;
}

function click() {
if (event.button==2) {
alert(]]}中国黄沙果园信息网!欢迎您的到来!]]})
}
}
document.onmousedown=click

</script>
解开右键:先按左健不动,按下右健,放开左健,放开右健,就可以看到原来的菜单,用shift+F10也可以

5。怎样在flash里作的按键可指定连接在框架里?
双击按钮,然后在ACTIIONS,增加一个GET URL 在UAL写连接地址,在窗体写你的网页窗体名就可以啦
6。怎样使用网页JS提交发信给我?
:这是一个发信的完整代码 :<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD width="100%">
<FORM action=mailto:jinc@mail.sxptt.zj.cn?SUBJECT=信息反馈 encType=text/plain
method=post name=form >
<TABLE border=0 cellPadding=0 width="64%">
<TBODY>
<TR bgcolor="#FFFFCC">
<TD height=28 width="21%">地 址:</TD>
<TD height=28 width="79%">
<input type="text" name="add" size="40">
* </TD>
</TR>
<TR bgcolor="#FFFFCC">
<TD height=28 width="21%"><font
face=Arial>Email</font>:</TD>
<TD height=28 width="79%">
<INPUT name=email size=25>
*</TD>
</TR>
<TR bgcolor="#FFFFCC">
<TD height=28 width="21%">主页网址:</TD>
<TD height=28 width="79%">
<INPUT
name=url size=30 value=http://>
</TD>
</TR>
<TR bgcolor="#FFFFCC">
<TD height=28 width="21%">来信主题:</TD>
<TD height=28 width="79%">
<INPUT
checked name=主题 type=radio value=技术支持>
加入产品检索
<input name=主题
type=radio value=意见建议>
意见建议
<INPUT name=主题 type=radio
value=合作事项>
合作事项
<INPUT name=主题 type=radio value=其他>
其他</TD>
</TR>
<TR bgcolor="#FFFFCC">
<TD height=28 width="21%">内容:</TD>
<TD height=28 width="79%">
<textarea cols=40 name=DESCRIPTION rows=5 wrap=virtual></textarea>
</TD>
</TR>
<TR bgcolor="#FFFFCC">
<TD height=28 width="21%">nbsp;</TD>
<TD height=28 width="79%">
<P align=center><BR>
<INPUT name=submit type=submit value=立刻发信>
<INPUT type=reset value=重新填写>
<BR>
</P>
</TD>
</TR>
</TBODY>
</TABLE>
7。在网页中可以加入背景音乐,但一进入别的网页音乐就停止了,我想别人浏览我的网站时音乐一直演奏可有好的办法?
只有用分桢,背景音乐加到不动的桢上,或把这个桢高度设为0
8。请问 消除页面滚动条的代码是什么来着?
<body bgcolor="#FFFFFF" style="OVERFLOW-X: hidden; OVERFLOW-Y: hidden; width: 100%" >
9。如何在进入网站之前自动选择速度快的服务器进是怎么弄的谢谢?
使用ASP,CGU分析访问者的IP,再选择最近的服务器。
10。为何主页中有长篇大论时,拖滚动条时,屏幕好像不流畅 ?
这个与计算机的速度有关,速度非常快的话,就不会出项这种情况
11。请教,做网页怎样让弹出窗口关闭后不再出现?
首次访问前3次才打开。第四次不打开
<script language="JavaScript">
<!--
var caution = false
function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "")
if (!caution || (name + "=" + escape(value)).length <= 4000)
document.cookie = curCookie
else
if (confirm("Cookie exceeds 4KB and will be cut!"))
document.cookie = curCookie
}
function getCookie(name) {
var prefix = name + "="
var cookieStartIndex = document.cookie.indexOf(prefix)
if (cookieStartIndex == -1)
return null
var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
if (cookieEndIndex == -1)
cookieEndIndex = document.cookie.length
return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}
function deleteCookie(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT"
}
}
function fixDate(date) {
var base = new Date(0)
var skew = base.getTime()
if (skew > 0)
date.setTime(date.getTime() - skew)
}
var now = new Date()
fixDate(now)
now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000)
var visits = getCookie("counter")
if (!visits)
visits = 1
else
visits = parseInt(visits) + 1
setCookie("counter", visits, now)
document.write("您这是第 <font color=blue>" + visits + "<font color=black> 次浏览")
if (visits <3){ var hWnd=window.open(]]}http://www.myask.net/forum/homepage/index.html]]}, ]]}hi]]}, ]]}height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no]]});
}

// -->
</script>

12。能作个定时打开新窗口,并关闭原窗口的网页吗?
打开
<script language="javascript">
function refreshHTML()
{window.setTimeout("openw()",1000);
}
function openw()
{var hWnd=window.open(]]}http://pageroom.533.net/]]}, ]]}hi]]}, ]]}height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no]]});
}window.onload=refreshHTML</script>


关闭
<script language="javascript">
function ccc()
{window.close();
}
function refreshHTML()
{window.setTimeout("ccc()",2000);
}
window.onload=refreshHTML</script>