- 浏览: 31991 次
- 性别:
- 来自: 抚顺
最近访客 更多访客>>
文章分类
最新评论
-
ejacky:
三年前的自己
初次面试败北之我326块钱学到的 -
skanion:
access的数据库路径可以设为相对路径,即getClass( ...
jabc绑定access数据库 -
skanion:
还有代码不缩进
jabc绑定access数据库 -
skanion:
大哥, 标题都写错了。。。。
jabc绑定access数据库 -
skanion:
学java 转 android吧
初次面试败北之我326块钱学到的
一页面特效
1字符从天而降
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language="JavaScript" FPTYPE="dynamicanimation8">
<!--
dynamicanimAttr = "dynamicanimation8"
animateElements = new Array()
currentElement = 0
speed = 0
stepsZoom = 8
stepsWord = 8
stepsFly = 12
stepsSpiral = 16
steps = stepsZoom
step = 0
outString = ""
function dynAnimation8()
{
var ms = navigator.appVersion.indexOf("MSIE")
ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4)
if(!ie4)
{
if((navigator.appName == "Netscape") &&
(parseInt(navigator.appVersion.substring(0, 1)) >= 4))
{
for (index=document.layers.length-1; index >= 0; index--)
{
layer=document.layers[index]
if (layer.left==10000)
layer.left=0
}
}
return
}
for (index=document.all.length-1; index >= document.body.sourceIndex; index--)
{
el = document.all[index]
animation = el.getAttribute(dynamicanimAttr, false)
if(null != animation)
{
if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord")
{
ih = el.innerHTML
outString = ""
i1 = 0
iend = ih.length
while(true)
{
i2 = startWord(ih, i1)
if(i2 == -1)
i2 = iend
outWord(ih, i1, i2, false, "")
if(i2 == iend)
break
i1 = i2
i2 = endWord(ih, i1)
if(i2 == -1)
i2 = iend
outWord(ih, i1, i2, true, animation)
if(i2 == iend)
break
i1 = i2
}
document.all[index].innerHTML = outString
document.all[index].style.posLeft = 0
document.all[index].setAttribute(dynamicanimAttr, null)
}
if(animation == "zoomIn" || animation == "zoomOut")
{
ih = el.innerHTML
outString = "<SPAN " + dynamicanimAttr + "=\"" + animation + "\" style=\"position: relative; left: 10000;\">"
outString += ih
outString += "</SPAN>"
document.all[index].innerHTML = outString
document.all[index].style.posLeft = 0
document.all[index].setAttribute(dynamicanimAttr, null)
}
}
}
i = 0
for (index=document.body.sourceIndex; index < document.all.length; index++)
{
el = document.all[index]
animation = el.getAttribute(dynamicanimAttr, false)
if (null != animation)
{
if(animation == "flyLeft")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = 0
}
else if(animation == "flyRight")
{
el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
el.style.posTop = 0
}
else if(animation == "flyTop" || animation == "dropWord")
{
el.style.posLeft = 0
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "flyBottom")
{
el.style.posLeft = 0
el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
}
else if(animation == "flyTopLeft")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "flyTopRight" || animation == "flyTopRightWord")
{
el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "flyBottomLeft")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
}
else if(animation == "flyBottomRight" || animation == "flyBottomRightWord")
{
el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
}
else if(animation == "spiral")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "zoomIn")
{
el.style.posLeft = 10000
el.style.posTop = 0
}
else if(animation == "zoomOut")
{
el.style.posLeft = 10000
el.style.posTop = 0
}
else
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = 0
}
el.initLeft = el.style.posLeft
el.initTop = el.style.posTop
animateElements[i++] = el
}
}
window.setTimeout("animate();", speed)
}
function offsetLeft(el)
{
x = el.offsetLeft
for (e = el.offsetParent; e; e = e.offsetParent)
x += e.offsetLeft;
return x
}
function offsetTop(el)
{
y = el.offsetTop
for (e = el.offsetParent; e; e = e.offsetParent)
y += e.offsetTop;
return y
}
function startWord(ih, i)
{
for(tag = false; i < ih.length; i++)
{
c = ih.charAt(i)
if(c == '<')
tag = true
if(!tag)
return i
if(c == '>')
tag = false
}
return -1
}
function endWord(ih, i)
{
nonSpace = false
space = false
while(i < ih.length)
{
c = ih.charAt(i)
if(c != ' ')
nonSpace = true
if(nonSpace && c == ' ')
space = true
if(c == '<')
return i
if(space && c != ' ')
return i
i++
}
return -1
}
function outWord(ih, i1, i2, dyn, anim)
{
if(dyn)
outString += "<SPAN " + dynamicanimAttr + "=\"" + anim + "\" style=\"position: relative; left: 10000;\">"
outString += ih.substring(i1, i2)
if(dyn)
outString += "</SPAN>"
}
function animate()
{
el = animateElements[currentElement]
animation = el.getAttribute(dynamicanimAttr, false)
step++
if(animation == "spiral")
{
steps = stepsSpiral
v = step/steps
rf = 1.0 - v
t = v * 2.0*Math.PI
rx = Math.max(Math.abs(el.initLeft), 200)
ry = Math.max(Math.abs(el.initTop), 200)
el.style.posLeft = Math.ceil(-rf*Math.cos(t)*rx)
el.style.posTop = Math.ceil(-rf*Math.sin(t)*ry)
}
else if(animation == "zoomIn")
{
steps = stepsZoom
el.style.fontSize = Math.ceil(50+50*step/steps) + "%"
el.style.posLeft = 0
}
else if(animation == "zoomOut")
{
steps = stepsZoom
el.style.fontSize = Math.ceil(100+200*(steps-step)/steps) + "%"
el.style.posLeft = 0
}
else
{
steps = stepsFly
if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord")
steps = stepsWord
dl = el.initLeft / steps
dt = el.initTop / steps
el.style.posLeft = el.style.posLeft - dl
el.style.posTop = el.style.posTop - dt
}
if (step >= steps)
{
el.style.posLeft = 0
el.style.posTop = 0
currentElement++
step = 0
}
if(currentElement < animateElements.length)
window.setTimeout("animate();", speed)
}
//-->
</SCRIPT>
第二步:把如下代码加入<body>区域中(也就是在页面中调用脚本)
<p dynamicanimation8="dropWord"
style="position: relative !important; left: 10000 !important" align="center"><font size="3" color="#ee00FF">很 好 玩 吧 ! 有 没 有 吓 一 跳 ?<font size="7"><b><font face="Arial, Helvetica, sans-serif" color="#FF0000">YES!
</font></b></font></font></p>
第三步:把<body>改为
<body onload="dynAnimation8()">
2打字机输出文字
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language="JavaScript">
<!--
var layers = document.layers, style = document.all, both = layers || style, idme=908601;
if (layers) { layerRef = 'document.layers'; styleRef = ''; } if (style) { layerRef = 'document.all'; styleRef = '.style'; }
function writeOnText(obj, str) {
if (layers) with (document[obj]) { document.open(); document.write(str); document.close(); }
if (style) eval(obj+'.innerHTML= str');
}
//以下是输出的内容,自己修改即可。
var dispStr = new Array(
"<font color=red size=3>欢迎光临精彩JavaScript世界...</font><br><font color=green size=3>你知道怎样在你的网页中做一个很酷的网页菜单吗?</font><br><font color=red size=3>你知道怎样让你的网页背景向上或向下移动吗?</font><br><font color=blue size=3>你知道怎样在你的主页中任意位置显示一个时钟吗?</font><br><font color=red size=3>你知道怎样在主页中做特效文字吗?</font><br><font color=black size=3>你知道怎样做一个很cool的日历吗?</font>"
);
var overMe=0;
function txtTyper(str, idx, idObj, spObj, clr1, clr2, delay, plysnd) {
var tmp0 = tmp1 = '', skip = 0;
if (both && idx <= str.length) {
if (str.charAt(idx) == '<') { while (str.charAt(idx) != '>') idx++; idx++; }
if (str.charAt(idx) == '&' && str.charAt(idx+1) != ' ') { while (str.charAt(idx) != ';') idx++; idx++; }
tmp0 = str.slice(0,idx);
tmp1 = str.charAt(idx++);
if (overMe==0 && plysnd==1) {
if (navigator.plugins[0]) {
if (navigator.plugins["LiveAudio"][0].type=="audio/basic" && navigator.javaEnabled()) {
document.embeds[0].stop();
setTimeout("document.embeds[0].play(false)",100); }
} else if (document.all) {
ding.Stop();
setTimeout("ding.Run()",100);
}
overMe=1;
} else overMe=0;
writeOnText(idObj, "<span class="+spObj+"><font color='"+clr1+"'>"+tmp0+"</font><font color='"+clr2+"'>"+tmp1+"</font></span>");
setTimeout("txtTyper('"+str+"', "+idx+", '"+idObj+"', '"+spObj+"', '"+clr1+"', '"+clr2+"', "+delay+" ,"+plysnd+")",delay);
}
}
function init() {
txtTyper(dispStr[0], 0, 'ttl0', 'ttl1', '#339933', '#99FF33', 50, 0);
}
// -->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<DIV class=ttl1 id=ttl0><SPAN class=ttl1></SPAN></DIV>
第三步:把<body>改为
<body onload="onload=init()">
3滚动显示的logo
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language="JavaScript">
<!--
var scrollerwidth=88
var scrollerheight=31
var scrollerbgcolor='white'
//每个图间暂停3秒。
var pausebetweenimages=3000
//边界下面的行,如果希望logo都是带连接的,只要加上<a>标签即可。
var slideimages=new Array()
slideimages[0]='<A href=http://bhysj.163.net/ target=_blank><IMG alt=痴人可不是傻子 border=0 height=31 src=chir.gif width=88></A>'
slideimages[1]='<A href=http://wjjader.126.com target=_blank><IMG alt=紫巾苑 border=0 height=31 src=zjlogo.gif width=88></A>'
slideimages[2]='<A href=http://hanyu2000.yeah.net/ target=_blank><IMG alt=碧空流云 border=0 height=31 src=bhlogo.gif width=88></A>'
slideimages[3]='<A href=http://tdyn.126.com target=_blank><IMG alt=天地有你 border=0 height=31 src=tdyn.gif width=88></A>'
slideimages[4]='<A href=http://teach.t500.net target=_blank><IMG alt=教师之家欢迎你 border=0 height=31 src=home2.gif width=88></A>'
//尽管填加更多的。
if (slideimages.length>1)
i=2
else
i=0
function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top>0&&tlayer.top<=5){
tlayer.top=0
setTimeout("move1(tlayer)",pausebetweenimages)
setTimeout("move2(document.main.document.second)",pausebetweenimages)
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout("move1(tlayer)",100)
}
else{
tlayer.top=scrollerheight
tlayer.document.write(slideimages[i])
tlayer.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}
function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
setTimeout("move2(tlayer2)",pausebetweenimages)
setTimeout("move1(document.main.document.first)",pausebetweenimages)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",100)
}
else{
tlayer2.top=scrollerheight
tlayer2.document.write(slideimages[i])
tlayer2.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}
function move3(whichdiv){
tdiv=eval(whichdiv)
if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=5){
tdiv.style.pixelTop=0
setTimeout("move3(tdiv)",pausebetweenimages)
setTimeout("move4(second2)",pausebetweenimages)
return
}
if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){
tdiv.style.pixelTop-=5
setTimeout("move3(tdiv)",100)
}
else{
tdiv.style.pixelTop=scrollerheight
tdiv.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function move4(whichdiv){
tdiv2=eval(whichdiv)
if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=5){
tdiv2.style.pixelTop=0
setTimeout("move4(tdiv2)",pausebetweenimages)
setTimeout("move3(first2)",pausebetweenimages)
return
}
if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){
tdiv2.style.pixelTop-=5
setTimeout("move4(second2)",100)
}
else{
tdiv2.style.pixelTop=scrollerheight
tdiv2.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function startscroll(){
if (document.all){
move3(first2)
second2.style.top=scrollerheight
}
else if (document.layers){
move1(document.main.document.first)
document.main.document.second.top=scrollerheight+5
document.main.document.second.visibility='show'
}
}
window.onload=startscroll
//-->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<ilayer id="main" width=&{scrollerwidth}; height=&{scrollerheight}; bgcolor=&{scrollerbgcolor};>
<layer id="first" left=0 top=1 width=&{scrollerwidth};>
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[0])
</script>
</layer>
<layer id="second" left=0 top=0 width=&{scrollerwidth}; visibility=hide>
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[1])
</script>
</layer>
</ilayer>
<p>
<SCRIPT language="JavaScript">
<!--
if (document.all){
document.writeln('<span id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hiden;background-color:'+scrollerbgcolor+'">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0;top:0">')
document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0;top:1;">')
document.write(slideimages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0;top:0">')
document.write(slideimages[1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</span>')
}
//-->
</SCRIPT>
4文本自动滚屏
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function selectScroller(n) {
optlist = document.scrollform.scroller;
optlist[optlist.length] = new Option(optlist[0].text, "", false, false);
optlist[0] = null;
optlist.selectedIndex = -1;
n = (n + 1) % optlist.length;
// change the speed below: 1000 = 1 second.
setTimeout("selectScroller("+n+")",2000);
}
// End -->
</script>
第二步:把如下代码加入<body>区域中
<form name="scrollform">
<select name="scroller" size=8>
<option>This select option list will
<option>scroll text by copying
<option>the top line to the bottom
<option>line before deleting the
<option>top line. This moves the
<option>options up one line and
<option>gives the impression of
<option>scrolling.
<option>
<option>You can leave as many
<option>blank lines as you feel
<option>necessary to give the
<option>look of begining and
<option>ending.
<option>
<option>This script was written
<option>in response to those
<option>who wanted a news
<option>scroller to work within
<option>a table's cell and for
<option>those who want old
<option>browsers to also see
<option>a scoller on the page.
<option>
<option>This select option list will
<option>scroll text by copying
<option>the top line to the bottom
<option>line before deleting the
<option>top line. This moves the
<option>options up one line and
<option>gives the impression of
<option>scrolling.
<option>
<option>You can leave as many
<option>blank lines as you feel
<option>necessary to give the
<option>look of begining and
<option>ending.
<option>
<option>This script was written
<option>in response to those
<option>who wanted a news
<option>scroller to work within
<option>a table's cell and for
<option>those who want old
<option>browsers to also see
<option>a scoller on the page.
<option>
<option>yobo42@hotmail.com
</select>
</form>
第三步:把<body>改为
<BODY OnLoad="selectScroller(0);">
5控制别人输入的字数
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
maxLen = 130; // max number of characters allowed
function checkMaxInput(form) {
if (form.message.value.length > maxLen) // if too long.... trim it!
form.message.value = form.message.value.substring(0, maxLen);
// otherwise, update 'characters left' counter
else form.remLen.value = maxLen - form.message.value.length;
}
// End -->
</script>
第二步:把如下代码加入<body>区域中
<form name=myform action="YOUR-SCRIPT.CGI">
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )<br>
<textarea name=message wrap=physical cols=28 rows=4 onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="130"> characters left</font>
</form>
6文本上下跳
脚本说明:
把如下代码加入<body>区域中
<script language="JavaScript">
<!--
done = 0;
step = 4
function anim(yp,yk)
{
if(document.layers) document.layers["napis"].top=yp;
else document.all["napis"].style.top=yp;
if(yp>yk) step = -4
if(yp<60) step = 4
setTimeout('anim('+(yp+step)+','+yk+')', 10);
}
function start()
{
if(done) return
done = 1;
if(navigator.appName=="Netscape") {
document.napis.left=innerWidth/2 - 145;
anim(60,innerHeight - 60)
}
else {
napis.style.left=280;
anim(60,document.body.offsetHeight - 60)
}
}
//-->
</script>
<div id="napis"
style="position: absolute; top: 159px; width: 400px; height: 78px; left: 215px"><font size="5"><b>上下不停弹跳的文本</b></font></div>
<script language="JavaScript">
<!--
setTimeout('start()',10);
//-->
</script>
7特酷消隐字体
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language="JavaScript">
<!--
var thissize=20
var textfont="隶书"
var textcolor= new Array()
textcolor[0]="000000"
textcolor[1]="000000"
textcolor[2]="000000"
textcolor[3]="111111"
textcolor[4]="222222"
textcolor[5]="333333"
textcolor[6]="444444"
textcolor[7]="555555"
textcolor[8]="666666"
textcolor[9]="777777"
textcolor[10]="888888"
textcolor[11]="999999"
textcolor[12]="aaaaaa"
textcolor[13]="bbbbbb"
textcolor[14]="cccccc"
textcolor[15]="dddddd"
textcolor[16]="eeeeee"
textcolor[17]="ffffff"
textcolor[18]="ffffff"
var message = new Array()
message[0]="欢迎光临超级JAVA酷"
message[1]="请多停留一会"
message[2]="你会有更多的收获"
message[3]="请再次光临"
i_message=0
var i_strength=0
var i_message=0
var timer
function glowtext() {
if(document.all) {
if (i_strength <=17) {
glowdiv.innerText=message[i_message]
document.all.glowdiv.style.filter="glow(color="+textcolor[i_strength]+", strength=4)"
i_strength++
timer=setTimeout("glowtext()",100)
}
else {
clearTimeout(timer)
setTimeout("deglowtext()",1500)
}
}
}
function deglowtext() {
if(document.all) {
if (i_strength >=0) {
glowdiv.innerText=message[i_message]
document.all.glowdiv.style.filter="glow(color="+textcolor[i_strength]+", strength=4)"
i_strength--
timer=setTimeout("deglowtext()",100)
}
else {
clearTimeout(timer)
i_message++
if (i_message>=message.length) {i_message=0}
i_strength=0
intermezzo()
}
}
}
function intermezzo() {
glowdiv.innerText=""
setTimeout("glowtext()",1000)
}
//-->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<div id="glowdiv" style="position:absolute;visibility:visible;width:600px;text-align:center; top:185px;left:70px;font-family:隶书;font-size:30pt;color:000000"></div>
第三步:把<body>区中内容改为
<body onLoad="glowtext()">
8文本框栏目介绍
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var messages = new Array(6);
messages[0] = "";
messages[1] = "Have you ever seen anything like this before?";
messages[2] = "Can you imagine how you could use it on your site?";
messages[3] = "It's great for sharing lots of information.";
messages[4] = "And doesn't take up much space! ";
messages[5] = "So, get the code and put it on your site!";
function messageReveal() {
var messageindex = document.messageForm.messagePick.selectedIndex
document.messageForm.messageField.value = messages[messageindex];
}
// End -->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<form name="messageForm">
<select name="messagePick" OnChange="messageReveal()">
<option value="0">The Menu Message
<option>Seen this before?
<option>Possible uses?
<option>Shares Information
<option>Saves space
<option>Get the code!
</select>
<br><p>
<textarea name="messageField" rows=6 cols=50 wrap=virtual></textarea>
</form>
二 页面导航类
脚本说明:
把如下代码加入<body>区域中
<script language=javascript>
<!--
var index = 9
link = new Array(8);
text = new Array(8);
link[0] ='time1.htm'
link[1] ='time2.htm'
link[2] ='time3.htm'
link[3] ='time1.htm'
link[4] ='time2.htm'
link[5] ='time3.htm'
link[6] ='time1.htm'
link[7] ='time2.htm'
link[8] ='time3.htm'
text[0] ='说明一'
text[1] ='说明一'
text[2] ='说明一'
text[3] ='说明一'
text[4] ='说明一'
text[5] ='说明一'
text[6] ='说明一'
text[7] ='说明一'
text[8] ='说明一'
document.write ("<marquee scrollamount='1' scrolldelay='100' direction= 'up' width='150' height='150'>");
for (i=0;i<index;i++){
document.write (" <img src='arrow.gif' width='12' height='12'><a href="+link[i]+" target='_blank'>");
document.write (text[i] + "</A><br>");
}
document.write ("</marquee>")
// -->
</script>
3友情链接导航
脚本说明:
把如下代码加入<body>区域中(你可以对链接及说明作相应修改)
<script language="JavaScript"><!-- Hide function surfto(form) { var myindex=form.dest.selectedIndex location=form.dest.options[myindex].value;}//--></SCRIPT><FORM NAME="myform"> <SELECT NAME="dest" SIZE=4> <OPTION SELECTED VALUE="">选项<OPTION VALUE="search.htm">搜索引擎 <OPTION VALUE="chat.htm">聊天 </SELECT><INPUT TYPE="BUTTON" VALUE="GO NOW!" onClick="surfto(this.form)"></FORM>
4重要信息显示
脚本说明:
第一步:把如下代码加入<body>区域中
<script language="javascript">
//显示的信息,可以使用HTML语法,注意引号用法,单套双。
var message='<b><font size=5 face=arial color=red><a href="http://vs_server.njcatv.net/bbs" target="_blank">请点击进入本站BBS</a></font></b>'
//背景色
var backgroundcolor="#eeffee"
//0 代表信息永远显示,1 代表信息只显示一段时间,2为随机显示模式;
var displaymode=1
//如果显示模式为在指定时间内显示,输入时间段(1000为1秒);
var displayduration=30000
//1代表闪烁,0代表不闪烁;
var flashmode=1
//如果设置了闪烁,输入闪烁的颜色;
var flashtocolor="lightgreen"
////下面不必修改///
function regenerate(){
window.location.reload()
}
var which=0
function regenerate2(){
if (document.layers)
setTimeout("window.onresize=regenerate",400)
}
function display2(){
if (document.layers){
if (topmsg.visibility=="show")
topmsg.visibility="hide"
else
topmsg.visibility="show"
}
else if (document.all){
if (topmsg.style.visibility=="visible")
topmsg.style.visibility="hidden"
else
topmsg.style.visibility="visible"
setTimeout("display2()",Math.round(Math.random()*10000)+10000)
}
}
function flash(){
if (which==0){
if (document.layers)
topmsg.bgColor=flashtocolor
else
topmsg.style.backgroundColor=flashtocolor
which=1
}
else{
if (document.layers)
topmsg.bgColor=backgroundcolor
else
topmsg.style.backgroundColor=backgroundcolor
which=0
}
}
if (document.all){
document.write('<span id="topmsg" style="position:absolute;visibility:hidden">'+message+'</span>')
}
function logoit(){
document.all.topmsg.style.left=document.body.scrollLeft+document.body.clientWidth/2-document.all.topmsg.offsetWidth/2
document.all.topmsg.style.top=document.body.scrollTop+document.body.clientHeight-document.all.topmsg.offsetHeight-4
}
function logoit2(){
topmsg.left=pageXOffset+window.innerWidth/2-topmsg.document.width/2
topmsg.top=pageYOffset+window.innerHeight-topmsg.document.height-5
setTimeout("logoit2()",90)
}
function setmessage(){
document.all.topmsg.style.left=document.body.scrollLeft+document.body.clientWidth/2-document.all.topmsg.offsetWidth/2
document.all.topmsg.style.top=document.body.scrollTop+document.body.clientHeight-document.all.topmsg.offsetHeight-4
document.all.topmsg.style.backgroundColor=backgroundcolor
document.all.topmsg.style.visibility="visible"
if (displaymode==1)
setTimeout("topmsg.style.visibility='hidden'",displayduration)
else if (displaymode==2)
display2()
if (flashmode==1)
setInterval("flash()",1000)
window.onscroll=logoit
window.onresize=new Function("window.location.reload()")
}
function setmessage2(){
topmsg=new Layer(window.innerWidth)
topmsg.bgColor=backgroundcolor
regenerate2()
topmsg.document.write(message)
topmsg.document.close()
logoit2()
topmsg.visibility="show"
if (displaymode==1)
setTimeout("topmsg.visibility='hide'",displayduration)
else if (displaymode==2)
display2()
if (flashmode==1)
setInterval("flash()",1000)
}
if (document.layers)
window.onload=setmessage2
else if (document.all)
window.onload=setmessage
</script>
6不停变化的导航
脚本说明:
第一步:把如下代码加入<head>区域中(你可以对链接及说明作相应修改)
<SCRIPT LANGUAGE="JavaScript">
<!-- begin
// please help yourself to this code.
var startTime =null;
var timerID =null;
var initial =new Date();
var pos =0;
var menuItem =null;
function initArray() {
this.length = initArray.arguments.length
for (var i = 0; i < this.length; i++) {
this[i+1] = initArray.arguments[i]
}
}
function parsemenuItem(data,num) {
for(var i=0;i<data.length;i++) {
if(data.substring(i,i+1)=="|") break;
}
if (num==0) return(data.substring(0,i));
else return(data.substring(i+1,data.length));
}
function startTimer() {
initial = new Date();
startTime=initial.getTime();
stopTimer();
menuItem = new initArray("Netscape|http://www.netscape.com",
"Microsoft|http://www.microsoft.com",
"IBM|http://www.ibm.com",
"Yahoo|http://www.yahoo.com",
"Excite|http://www.excite.com",
"Hotbot|http://www.hotbot.com",
"GrapeJam|http://www.grapejam.com",
"Email|mailto:rzeitel@mars.superlink.net"
);
showTimer();
}
function stopTimer() {
timerID=null;
menuItem=null;
//clearTimeout(timerID);
}
function showTimer() {
pos= (pos == menuItem.length) ? 1 : pos + 1;
document.forms[0].elements[0].value=parsemenuItem(menuItem[pos],0);
timerID=window.setTimeout('showTimer()',4000);
}
function goToUrl() {
//parent.welcome.location=parsemenuItem(menuItem[pos],1);
this.location=parsemenuItem(menuItem[pos],1);
return (false);
}
// end -->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<FORM>
<INPUT TYPE="button" VALUE=" WHERE TO? " NAME="goTo"
onClick="window.goToUrl()">
</FORM>
第三步:把<body>中的内容改为:
<body onLoad="window.startTimer()">
三 背景颜色类
1 背景颜色安全测试
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language=javascript>
<!--
function makeArray(q){for(i=1;i<=q;i++){this[i]=0}}Colors=new makeArray(7);Colors[1]="00";Colors[2]="33";Colors[3]="66";Colors[4]="99";Colors[5]="CC";Colors[6]="FF";
-->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<center><table cellspacing=0 cellpadding=0><SCRIPT language=javascript>
<!--
for(i=1;i<=6;i++){for(j=1;j<=6;j++){for(k=1;k<=6;k++){var thiscolor=Colors[i]+Colors[j]+Colors[k];document.writeln("<tr><td height = 20 bgcolor = \"#" + thiscolor + "\" align = right><a href = ");document.writeln("\'\' onMouseOver = \"document.bgColor=\'"+thiscolor+"\'\">"+thiscolor+"</a></td></tr>");}}}
-->
</SCRIPT></table></center>
2 礼花背景
脚本说明:
把如下代码加入<body>区域中
<layer name="a0" left=10 top=10 visibility=show bgcolor="#ffffff" clip="0,0,1,1"></layer>
<layer name="a1" left=10 top=10 visibility=show bgcolor="#fff000" clip="0,0,1,1"></layer>
<layer name="a2" left=10 top=10 visibility=show bgcolor="#ffa000" clip="0,0,1,1"></layer>
<layer name="a3" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>
<layer name="a4" left=10 top=10 visibility=show bgcolor="#00ff00" clip="0,0,1,1"></layer>
<layer name="a5" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>
<layer name="a6" left=10 top=10 visibility=show bgcolor="#ff0000" clip="0,0,1,1"></layer>
<layer name="a7" left=10 top=10 visibility=show bgcolor="#ffffff" clip="0,0,1,1"></layer>
<layer name="a8" left=10 top=10 visibility=show bgcolor="#fff000" clip="0,0,1,1"></layer>
<layer name="a9" left=10 top=10 visibility=show bgcolor="#ffa000" clip="0,0,1,1"></layer>
<layer name="a10" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>
<layer name="a11" left=10 top=10 visibility=show bgcolor="#00ff00" clip="0,0,2,2"></layer>
<layer name="a12" left=10 top=10 visibility=show bgcolor="#0000ff" clip="0,0,2,2"></layer>
<layer name="a13" left=10 top=10 visibility=show bgcolor="#ff0000" clip="0,0,2,2"></layer>
<div id="starsDiv" style="position:absolute;top:0px;left:0px">
<div style="position:relative;width:2px;height:2px;background:#ffffff;font-size:2px"></div>
<div style="position:relative;width:1px;height:1px;background:#fff000;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#ffa000;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#ff00ff;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#00ff00;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#0000ff;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#FF0000;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#ffffff;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#fff000;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#ffa000;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#ff00ff;font-size:1px"></div>
<div style="position:relative;width:2px;height:2px;background:#ff00ff;font-size:2px"></div>
<div style="position:relative;width:1px;height:1px;background:#0000ff;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#FF0000;font-size:1px"></div>
</div>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var Clrs = new Array(9);
Clrs[0] = 'ff0000';
Clrs[1] = '00ff00';
Clrs[2] = '000aff';
Clrs[3] = 'ff00ff';
Clrs[4] = 'ffa500';
Clrs[5] = 'ffff00';
Clrs[6] = '00ff00';
Clrs[7] = 'ffffff';
Clrs[8] = 'fffff0';
var sClrs = new Array(5);
sClrs[0] = 'ffa500';
sClrs[1] = '55ff66';
sClrs[2] = 'AC9DFC';
sClrs[3] = 'fff000';
sClrs[4] = 'fffff0';
var yBase;
var xBase;
var step;
var currStep = 0;
var Xpos = 1;
var Ypos = 1;
var initialStarColor = 'ffa000';
var Mtop = 250;
var Mleft = 250;
function Fireworks() {
if (document.all) {
yBase = window.document.body.offsetHeight / 3;
xBase = window.document.body.offsetWidth / 8;
}
else if (document.layers) {
yBase = window.innerHeight / 3;
xBase = window.innerWidth / 8;
}
if (document.all) {
step = 5;
for ( i = 0 ; i < starsDiv.all.length ; i++ ) {
for (ai = 0; ai < Clrs.length; ai++) {
var c = Math.round(Math.random()*[ai]);
}
if (currStep < 90)
starsDiv.all[i].style.background=initialStarColor;
if (currStep > 90)
starsDiv.all[i].style.background=Clrs[c];
starsDiv.all[i].style.top = Mtop + yBase*Math.sin((currStep+i*5)/3)*Math.sin(550+currStep/100)
starsDiv.all[i].style.left = Mleft + yBase*Math.cos((currStep+i*5)/3)*Math.sin(550+currStep/100)
}
}
else if (document.layers) {
step = 5;
for ( j = 0 ; j < 24 ; j++ ) { //number of NS layers!
var templayer = "a"+j;
for (ai = 0; ai < Clrs.length; ai++) {
var c = Math.round(Math.random()*[ai]);
}
if (currStep < 90)
document.layers[templayer].bgColor=initialStarColor;
if (currStep > 90)
document.layers[templayer].bgColor=Clrs[c];
document.layers[templayer].top = Mtop + yBase*Math.sin((currStep+j*5)/3)*Math.sin(550+currStep/100)
document.layers[templayer].left = Mleft + yBase*Math.cos((currStep+j*5)/3)*Math.sin(550+currStep/100)
}
}
currStep+= step;
T=setTimeout("Fireworks()",5);
if (currStep == 220) {
currStep = -10;
for (n = 0; n < sClrs.length; n++) {
var k = Math.round(Math.random()*n);
}
initialStarColor = sClrs[k];
if (document.all) {
Dtop = window.document.body.clientHeight - 250;
Dleft = xBase * 3.5;
Mtop = Math.round(Math.random()*Dtop);
Mleft = Math.round(Math.random()*Dleft);
document.all.starsDiv.style.top = Mtop+document.body.scrollTop;
document.all.starsDiv.style.left = Mleft+document.body.scrollLeft;
}
else if (document.layers) {
Dleft = window.innerWidth - 100;
Dtop = window.innerHeight - 100;
Mtop = Math.round(Math.random()*Dtop+window.pageYOffset);
Mleft = Math.round(Math.random()*Dleft+window.pageXOffset);
document.layers[templayer].top = Mtop;
document.layers[templayer].left = Mleft;
}
if ((Mtop < 20) || (Mleft < 20)) {
Mtop += 90;
Mleft += 90;
}
}
}
Fireworks();
// End -->
</script>
3 手动调色
脚本说明:
把如下代码加入<body>区域中
<script language="JavaScript">
<!-- Hiding
var red=0;
var green=0;
var blue=0;
var value=0;
var convert = new Array()
var hexbase= new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");
for (x=0; x<16; x++){
for (y=0; y<16; y++){
convert[value]= hexbase[x] + hexbase[y];
value++;
}
}
function clear(){
document.color.bl.value= blue;
document.color.rd.value= red;
document.color.gr.value= green;
}
function display(){
redx = convert[red]
greenx = convert[green]
bluex = convert[blue]
var rgb = "#"+redx+greenx+bluex;
document.color.rgbdspl.value= rgb;
document.bgColor =rgb;
}
function upred(x){
if ((red+x)<=255)
red+=x
document.color.rd.value= red;
display()
}
function downred(x){
if ((red-x)>=0)
red-=x
document.color.rd.value= red;
display()
}
function upgreen(x){
if ((green+x)<=255)
green+=x
document.color.gr.value= green;
display()
}
function downgreen(x){
if ((green-x)>=0)
green-=x
document.color.gr.value= green;
display()
}
function upblue(x){
if ((blue+x)<=255)
blue+=x
document.color.bl.value= blue;
display()
}
function downblue(x){
if ((blue-x)>=0)
blue-=x
document.color.bl.value= blue;
display()
}
// done hiding -->
</script>
<form name="color">
<table>
<tr align="Center">
<td>
<input name="red" type="button" value=" +50 " onClick="upred(50)">
</td>
<td>
<input name="red2" type="button" value=" + 10 " onClick="upred(10)">
</td>
<td>
<input name="red2" type="button" value=" + 1" onClick="upred(1)">
</td>
<td width="50"><font color="#FF0000" size=+3><b><font color="#FA0000">红</font></b></font></td>
<td>
<input name="red-" type="button" value=" - 1" onClick="downred(1)">
</td>
<td>
<input name="red-" type="button" value=" - 10 " onClick="downred(10)">
</td>
<td>
<input name="red-" type="button" value=" -50 " onClick="downred(50)">
</td>
<td>
<input type="text" name="rd" size=3>
</td>
</tr>
<tr align="Center">
<td>
<input name="green" type="button" value=" +50 " onClick="upgreen(50)">
</td>
<td>
<input name="green" type="button" value=" + 10 " onClick="upgreen(10)">
</td>
<td>
<input name="green" type="button" value=" + 1" onClick="upgreen(1)">
</td>
<td width="50"><font color="#00FF00" size=+3><b><font color="#00FA00">绿</font></b></font></td>
<td>
<input name="green-" type="button" value=" - 1" onClick="downgreen(1)">
</td>
<td>
<input name="green-" type="button" value=" - 10 " onClick="downgreen(10)">
</td>
<td>
<input name="green-" type="button" value=" -50 " onClick="downgreen(50)">
</td>
<td>
<input type="text" name="gr" size=3>
</td>
</tr>
<tr align="Center">
<td>
<input name="blue" type="button" value=" +50 " onClick="upblue(50)">
</td>
<td>
<input name="blue" type="button" value=" + 10 " onClick="upblue(10)">
</td>
<td>
<input name="blue" type="button" value=" + 1" onClick="upblue(1)">
</td>
<td width="50"><font color="#0000FF" size=+3><b><font color="#0000FA">蓝</font></b></font></td>
<td>
<input name="blue-" type="button" value=" - 1" onClick="downblue(1)">
</td>
<td>
<input name="blue-" type="button" value=" - 10 " onClick="downblue(10)">
</td>
<td>
<input name="blue-" type="button" value=" -50 " onClick="downblue(50)">
</td>
<td>
<input type="text" name="bl" size=3>
</td>
</tr>
<tr align="Center">
<td> </td>
<td> </td>
<td> </td>
<td width="50">
<input type="text" name="rgbdspl" size=7>
</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</form>
4下雨
脚本说明:
把如下代码加入<body>区域中
<script language="JavaScript">
<!--
var no = 50;
var speed = 1;
var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;
var s, x, y, sn, cs;
var a, r, cx, cy;
var i, doc_width = 800, doc_height = 600;
if (ns4up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
}
else
if (ie4up) {
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
x = new Array();
y = new Array();
r = new Array();
cx = new Array();
cy = new Array();
s = 8;
for (i = 0; i < no; ++ i) {
initRain();
if (ns4up) {
if (i == 0) {
document.write("<layer name=\"dot"+ i +"\" left=\"1\" ");
document.write("top=\"1\" visibility=\"show\"><font color=\"red\">");
document.write(",</font></layer>");
}
else {
document.write("<layer name=\"dot"+ i +"\" left=\"1\" ");
document.write("top=\"1\" visibility=\"show\"><font color=\"red\">");
document.write(",</font></layer>");
}
}
else
if (ie4up) {
if (i == 0) {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write("visible; TOP: 15px; LEFT: 15px;\"><font color=\"red\">");
document.write(",</font></div>");
}
else {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write("visible; TOP: 15px; LEFT: 15px;\"><font color=\"red\">");
document.write(",</font></div>");
}
}
}
function initRain() {
a = 6;
r[i] = 1;
sn = Math.sin(a);
cs = Math.cos(a);
cx[i] = Math.random() * doc_width + 1;
cy[i] = Math.random() * doc_height + 1;
x[i] = r[i] * sn + cx[i];
y[i] = cy[i];
}
function makeRain() {
r[i] = 1;
cx[i] = Math.random() * doc_width + 1;
cy[i] = 1;
x[i] = r[i] * sn + cx[i];
y[i] = r[i] * cs + cy[i];
}
function updateRain() {
r[i] += s;
x[i] = r[i] * sn + cx[i];
y[i] = r[i] * cs + cy[i];
}
function raindropNS() {
for (i = 0; i < no; ++ i) {
updateRain();
if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) {
makeRain();
doc_width = self.innerWidth;
doc_height = self.innerHeight;
}
document.layers["dot"+i].top = y[i];
document.layers["dot"+i].left = x[i];
}
setTimeout("raindropNS()", speed);
}
function raindropIE() {
for (i = 0; i < no; ++ i) {
updateRain();
if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) {
makeRain();
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
document.all["dot"+i].style.pixelTop = y[i];
document.all["dot"+i].style.pixelLeft = x[i];
}
setTimeout("raindropIE()", speed);
}
if (ns4up) {
raindropNS();
}
else
if (ie4up) {
raindropIE();
}
-->
</script>
5按钮驱动背景
脚本说明:
把如下代码加入<body>区域中:
<script language="JavaScript">
var COLOR = 999999
var woot = 0
function stoploop()
{
document.bgColor = '#336699';
clearTimeout(loopID);
}
function loopBackground()
{
if (COLOR > 0)
{
document.bgColor = '#' + COLOR
COLOR -= 111111
loopID = setTimeout("loopBackground()",1)
}
else
{
document.bgColor = '#336699'
woot += 10
COLOR = 999999
COLOR -= woot
loopID = setTimeout("loopBackground()",1)
}
}
</script>
<input type="button" value="Start bgColor WARP" onClick="loopBackground()"><br>
<input type="button" value=" Stop bgColor WARP" onClick="stoploop()">
四 按钮特效类
1 死机代码
2 关不掉页面
脚本说明:
把如下代码加入<body>区域中:
<input type=button value=hmm onClick="var e=1;while(1==1){alert('你是关不掉我的!!!')}">
3 循环警告 ,关不掉浏览器
脚本说明:
把如下代码加入<body>区域中:
<script>
<!-- Script by Juan Valdez
function hate()
{
alert(' from ');
alert(' what');
alert(' you');
alert(' can');
alert(' see');
alert(' this');
alert(' is');
alert(' annoying');
return hate()
}
//-- done -->
</script>
<a href="javascript:hate()" onmouseover="window.status='按了可就关不掉了!';return true">
<b>最好别按</b></a>
4窗口抖动 ///// ***********
脚本说明:
把如下代码加入<body>区域中:
<script language="JavaScript">
<!--
function surfto(form) {
var myindex=form.select1.selectedIndex
if (form.select1.options[myindex].value != null) {
parent.main.location.href=form.select1.options[myindex].value;
}
}
// -->
</script>
<script language="JavaScript1.2">
<!--
function shake(n) {
if (window.top.moveBy) {
for (i = 10; i > 0; i--) {
for (j = n; j > 0; j--) {
window.top.moveBy(0,i);
window.top.moveBy(i,0);
window.top.moveBy(0,-i);
window.top.moveBy(-i,0);
}
}
}
alert(" 没吓坏吧!!! ");
}
// End -->
</script>
<script
language="JavaScript">
<!--
function moyamoya(htmlfile) {
parent.main.location.href=htmlfile;
}
// -->
</script>
<form>
<div align="center"><center><p><input onclick="shake(2)" type="button"
value="地震拉!!!"> </p>
</center></div>
</form>
5页面被冻结
脚本说明:
把如下代码加入<body>区域中
<script>
function freeze(){
alert ('对不起,你死机了,哈哈!!!');while(true){window.history.back(-1)}}
</script>
<FORM>
<INPUT TYPE="BUTTON" VALUE="Freeze" onClick="freeze()">
</FORM>
五 鼠标事件类
1图片跟随鼠标
脚本说明:
第一步:把如下代码加入<body>区域中
<SCRIPT LANGUAGE="JavaScript">
var newtop=0
var newleft=0
if (navigator.appName == "Netscape") {
layerStyleRef="layer.";
layerRef="document.layers";
styleSwitch="";
}
else
{
layerStyleRef="layer.style.";
layerRef="document.all";
styleSwitch=".style";
}
function doMouseMove() {
layerName = 'iit'
eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')
eval('curElement'+styleSwitch+'.visibility="visible"')
eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')
eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')
eval('height=curElement'+styleSwitch+'.height')
eval('width=curElement'+styleSwitch+'.width')
width=parseInt(width)
height=parseInt(height)
if (event.clientX > (document.body.clientWidth - 5 - width))
{
newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width
}
else
{
newleft=document.body.scrollLeft + event.clientX
}
eval('curElement'+styleSwitch+'.pixelLeft=newleft')
if (event.clientY > (document.body.clientHeight - 5 - height))
{
newtop=document.body.clientHeight + document.body.scrollTop - 5 - height
}
else
{
newtop=document.body.scrollTop + event.clientY
}
eval('curElement'+styleSwitch+'.pixelTop=newtop')
}
document.onmousemove = doMouseMove;
</SCRIPT>
第二步:把如下代码加入<body>区域中
<script language="javascript">
if (navigator.appName == "Netscape") {
}
else
{
document.write('<div ID=OuterDiv>')
document.write('<img ID=iit src="image1.gif" STYLE="position:absolute;TOP:0pt;LEFT:0pt;width=103;height=28;Z-INDEX:2;visibility:hidden;">')
document.write('</div>')
}
</script>
2禁用左键
脚本说明:
把如下代码加入<head>区域中
<script language="javascript">
function click() {
if (event.button==1) { //改成button==2为禁止右键
alert('对不起,禁止使用此功能.')
}
}
document.onmousedown=click
</script>
3 鼠标点击效果
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
var ver = navigator.appVersion;
var dom = document.getElementById ? 1 : 0;
var ie5 = (ver.indexOf("MSIE 5") > -1 && dom) ? 1 : 0;
var n = (document.layers);
var ie = (document.all);
var sparksAflyin = 0;
var totalSparks = 0;
var sparksOn = 1;
function initMouseEvents() {
document.onmousedown = mouseDown;
if (n) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
}
function mouseDown(e) {
if (sparksOn) {
var mousex = (n) ? e.pageX : event.x+document.body.scrollLeft;
var mousey = (n) ? e.pageY : event.y+document.body.scrollTop;
if (!sparksAflyin) {
for (var k = 0; k <= 9; k++)
eval('SHOW("sDiv'+k+'")');
sparksAflyin = 1;
totalSparks = 0;
for(i = 0;i <= 9; i++)
eval('moveTo('+i+',0,'+mousex+','+mousey+')');
}
}
}
function moveTo(i,j, mousex, mousey){
if (j < eval('anim_'+i+'_x.length') ){
var tempx = eval('anim_'+i+'_x[j]+mousex');
var tempy = eval('anim_'+i+'_y[j]+mousey');
if (ie) {
if(tempy+30 > (document.body.offsetHeight+document.body.scrollTop))
tempy = document.body.offsetHeight+document.body.scrollTop-30;
if(tempx+30 > (document.body.offsetWidth+document.body.scrollLeft))
tempx = document.body.offsetWidth+document.body.scrollLeft-30;
eval('document.all.sDiv'+i+'.style.left = tempx;');
eval('document.all.sDiv'+i+'.style.top = tempy;');
}
if (n) {
eval('document.layers.sDiv'+i+'.left = tempx;');
eval('document.layers.sDiv'+i+'.top = tempy;');
}
j++;
// timeout: 50 = fireworks speed, larger number = slower speed
setTimeout("moveTo("+i+","+j+","+mousex+","+mousey+")",50)
}
else {
eval('HIDE("sDiv'+i+'")');
totalSparks++;
}
if (totalSparks == 10) {
sparksAflyin = 0;
totalSparks = 0;
}
}
function SHOW(divName){
if (document.all)
eval('document.all.'+divName+'.style.visibility = "visible";');
else if (document.layers)
eval('document.layers["'+divName+'"].visibility = "visible";');
}
function HIDE(divName){
if (document.all)
eval('document.all.'+divName+'.style.visibility = "hidden";');
else if (document.layers)
eval('document.layers["'+divName+'"].visibility = "hide";');
}
anim_0_x=new Array(20,20,10,0,0,0,0,0,0,0,0,0);
anim_0_y=new Array(-20,-40,-60,-80,-60,-40,-20,0,20,40,60,80);
anim_1_x=new Array(20,20,17,36,60,78,90,92,93,98,108,120,133,152,181);
anim_1_y=new Array(-20,-20,-33,-38,-38,-27,-2,25,51,84,113,141,162,212,253);
anim_2_x=new Array(20,20,2,3,4,5,6,7,8,9,10,12,13,15,18);
anim_2_y=new Array(-20,-20,-33,-38,-38,-27,-2,25,51,84,113,141,162,212,253);
anim_3_x=new Array(-20,-20,-2,-1,7,10,18,35,60,102,94,94,93,97,108,111,117,127);
anim_3_y=new Array(-20,-25,-64,-89,-104,-150,-173,-197,-213,-199,-151,-101,-66,-17,27,87,140,189);
anim_4_x=new Array(-20,-20,-10,-39,-30,-69,-64,-138,-154,-200,-181,-209,-191,-207,-203,-213,-202,-221,-211);
anim_4_y=new Array(-20,-20,-28,-51,-79,-100,-135,-154,-193,-183,-149,-134,-89,-60,8,51,107,157,201);
anim_5_x=new Array(-20,-29,-51,-72,-105,-133,-164,-189,-209,-229,-247,-270,-279,-282,-283,-283,-285,-286,-288);
anim_5_y=new Array(-20,-55,-86,-116,-154,-183,-205,-217,-217,-198,-169,-120,-44,-8,40,87,144,190,248);
anim_6_x=new Array(-20,-20,-7,14,44,79,143,186,217,226,234,244,250,259,265,274);
anim_6_y=new Array(-20,-21,-72,-113,-139,-166,-188,-181,-126,-68,-3,54,134,187,215,257);
anim_7_x=new Array(20,20,-3,-9,-13,-27,-33,-44,-54,-66,-77,-95,-107,-136,-150,-160,-164,-168,-171,-172,-172,-176,-175);
anim_7_y=new Array(-20,-26,-43,-63,-89,-116,-145,-169,-201,-222,-240,-253,-254,-245,-220,-195,-160,-124,-81,-53,-26,19,68);
anim_8_x=new Array(-20,20,-35,39,0,45,-1,24,-15,14,-20,35,-18,38,-11,16,49,64,81,93,100,103,109);
anim_8_y=new Array(-20,-20,-32,-42,-62,-76,-89,-107,-132,-147,-173,-180,-192,-209,-236,-193,-119,-73,-24,51,95,130,188);
anim_9_x=new Array(-20,-51,-89,-110,-165,-191,-228,-240,-259,-271,-277,-281,-287);
anim_9_y=new Array(-20,-20,-35,-37,-34,-16,10,47,105,150,189,227,273);
// End -->
</script>
第二步:把<body>改为
<body OnLoad="initMouseEvents()">
第三步:在<body>区域中加入如下代码
<div id="sparks">
<div id="sDiv0" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">a</font></div>
<div id="sDiv1" style="position:absolute; visibility: hidden;"><font face="arial black" color="yellow">b</font></div>
<div id="sDiv2" style="position:absolute; visibility: hidden;"><font face="arial black" color="blue">c</font></div>
<div id="sDiv3" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">d</font></div>
<div id="sDiv4" style="position:absolute; visibility: hidden;"><font face="arial black" color="orange">e</font></div>
<div id="sDiv5" style="position:absolute; visibility: hidden;"><font face="arial black" color="white">f</font></div>
<div id="sDiv6" style="position:absolute; visibility: hidden;"><font face="arial black" color="green">g</font></div>
<div id="sDiv7" style="position:absolute; visibility: hidden;"><font face="arial black" color="skyblue">h</font></div>
<div id="sDiv8" style="position:absolute; visibility: hidden;"><font face="arial black" color="yellow">i</font></div>
<div id="sDiv9" style="position:absolute; visibility: hidden;"><font face="arial black" color="white">j</font></div>
</div>
4鼠标跟踪器
脚本说明:
把如下代码加入<body>区域中
<SCRIPT language="JavaScript">
<!--
B=document.all;
C=document.layers;
T1=new Array("trail1.gif",38,35,"trail2.gif",30,31,"trail3.gif",28,26,"trail4.gif",22,21,"trail5.gif",16,16)
nos=parseInt(T1.length/3)
rate=50
ie5fix1=0;
ie5fix2=0;
for (i=0;i<nos;i++){
createContainer("CUR"+i,i*10,i*10,i*3+1,i*3+2,"","<img src='"+T1[i*3]+"' width="+T1[(i*3+1)]+" height="+T1[(i*3+2)]+" border=0>")}
function createContainer(N,Xp,Yp,W,H,At,HT,Op,St){
with (document){
write((!B) ? "<layer id='"+N+"' left="+Xp+" top="+Yp+" width="+W+" height="+H : "<div id='"+N+"'"+" style='position:absolute;left:"+Xp+"; top:"+Yp+"; width:"+W+"; height:"+H+"; ");
if(St){
if (C)
write(" style='");
write(St+";' ")
}
else write((B)?"'":"");
write((At)? At+">" : ">");
write((HT) ? HT : "");
if (!Op)
closeContainer(N)
}
}
function closeContainer(){
document.write((B)?"</div>":"</layer>")
}
function getXpos(N){
return (B) ? parseInt(B[N].style.left) : C[N].left
}
function getYpos(N){
return (B) ? parseInt(B[N].style.top) : C[N].top
}
function moveContainer(N,DX,DY){
c=(B) ? B[N].style :C[N];c.left=DX;c.top=DY
}
function cycle(){
//if (IE5)
if (document.all&&window.print){
ie5fix1=document.body.scrollLeft;
ie5fix2=document.body.scrollTop;
}
for (i=0;i<(nos-1);i++){
moveContainer("CUR"+i,getXpos("CUR"+(i+1)),getYpos("CUR"+(i+1)))
}
}
function newPos(e){
moveContainer("CUR"+(nos-1),(B)?event.clientX+ie5fix1:e.pageX+2,(B)?event.clientY+ie5fix2:e.pageY+2
)
}
if(document.layers)
document.captureEvents(Event.MOUSEMOVE)
document.onmousemove=newPos
setInterval("cycle()",rate)
//-->
</SCRIPT>
6跟随鼠标的星星
脚本说明:
把如下代码加入<body>区域中
<script>
/*
Scrolling Image Map/Text Link Tooltip Script-
Special Thanks to: Rob(http://rob.yeah.net)
Miss Ann(http://annworld.126.com)
*/
if (!document.layers&&!document.all)
event="test"
function showtip2(current,e,text){
if (document.all&&document.readyState=="complete"){
document.all.tooltip2.innerHTML='<marquee style="border:1px solid black">'+text+'</marquee>'
document.all.tooltip2.style.pixelLeft=event.clientX+document.body.scrollLeft+10
document.all.tooltip2.style.pixelTop=event.clientY+document.body.scrollTop+10
document.all.tooltip2.style.visibility="visible"
}
else if (document.layers){
document.tooltip2.document.nstip.document.write('<b>'+text+'</b>')
document.tooltip2.document.nstip.document.close()
document.tooltip2.document.nstip.left=0
currentscroll=setInterval("scrolltip()",100)
document.tooltip2.left=e.pageX+10
document.tooltip2.top=e.pageY+10
document.tooltip2.visibility="show"
}
}
function hidetip2(){
if (document.all)
document.all.tooltip2.style.visibility="hidden"
else if (document.layers){
clearInterval(currentscroll)
document.tooltip2.visibility="hidden"
}
}
function scrolltip(){
if (document.tooltip2.document.nstip.left>=-document.tooltip2.document.nstip.document.width)
document.tooltip2.document.nstip.left-=5
else
document.tooltip2.document.nstip.left=150
}
</script>
<script language="JavaScript">
function YY_Layerfx(yyleft,yytop,yyfnx,yyfny,yydiv,yybilder,yyloop,yyto,yycnt,yystep) { //v1.2
//copyright (c)1999 Yaromat, Jaro von Flocken
if ((document.layers)||(document.all)){
with (Math) {yynextx= eval(yyfnx)}
with (Math) {yynexty= eval(yyfny)}
yycnt=(yyloop && yycnt>=yystep*yybilder)?0:yycnt+yystep;
if (document.layers){
eval(yydiv+".top="+(yynexty+yytop))
eval(yydiv+".left="+(yynextx+yyleft))
}
if (document.all){
eval("yydiv=yydiv.replace(/.layers/gi, '.all')");
eval(yydiv+".style.pixelTop="+(yynexty+yytop));
eval(yydiv+".style.pixelLeft="+(yynextx+yyleft));
}
argStr='YY_Layerfx('+yyleft+','+yytop+',"'+yyfnx+'","'+yyfny+'","'+yydiv+'",'+yybilder+','+yyloop+','+yyto+','+yycnt+','+yystep+')';
if (yycnt<=yystep*yybilder){eval(yydiv+".yyto=setTimeout(argStr,yyto)");}
}
}
function YY_Mousetrace(evnt) { //v1.2 copyright (c)1999 Yaromat
if (yyns4)
{if (evnt.pageX) {yy_ml=evnt.pageX; yy_mt=evnt.pageY;} }
else{
yy_ml=(event.clientX + document.body.scrollLeft);
yy_mt=(event.clientY + document.body.scrollTop);
}
if (yy_tracescript)eval(yy_tracescript)
}
</script>
<script language="JavaScript">
function PopWin()
{
var PopWin = window.open("new.htm","PopWin","toolbar=no,directries=no,scrollBars=yes,height=350,width=400");
}
</script>
<div id="tooltip2"
style="position:absolute;visibility:hidden;clip:rect(0 150 50 0);width:150px;background-color:lightyellow">
<layer name="nstip" width="1000px" bgcolor="lightyellow"> </layer>
</div>
<div id="yyd0"
style="position:absolute; left:10px; top:50px; width:3px; height:3px; z-index:1; background-color: #19636c; layer-background-color: #19636c; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<div
id="yyd1"
style="position:absolute; left:20px; top:50px; width:3px; height:3px; z-index:1; background-color: #708574; layer-background-color: #708574; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<div
id="yyd2"
style="position:absolute; left:30px; top:50px; width:3px; height:3px; z-index:1; background-color: #379bbf; layer-background-color: #379bbf; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<div
id="yyd3"
style="position:absolute; left:40px; top:50px; width:3px; height:3px; z-index:1; background-color: #25184c; layer-background-color: #25184c; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<div
id="yyd4"
style="position:absolute; left:50px; top:50px; width:3px; height:3px; z-index:1; background-color: #31bd3c; layer-background-color: #31bd3c; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<div
id="yyd5"
style="position:absolute; left:60px; top:50px; width:3px; height:3px; z-index:1; background-color: #c11efd; layer-background-color: #c11efd; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<script>
var yyns4=window.Event?true:false; var yy_mt = 0; var yy_ml = 0;
document.onmousemove = YY_Mousetrace;
yy_tracescript = '';
if (yyns4){ document.captureEvents(Event.MOUSEMOVE);
YY_Mousetrace('',',document.YY_Mousetrace1')}
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/39.83007847812662))+0)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/34.224861639800686))+0)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd0\']',2000,true,80,0,1);
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/27.66510707209673))+30)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/9.240632767417667))+30)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd1\']',2000,true,80,0,1);
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/16.45318944579641))+60)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/16.0564452288292))+60)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd2\']',2000,true,80,0,1);
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/6.95348954836835))+90)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/44.13697049887155))+90)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd3\']',2000,true,80,0,1);
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/33.90077294583733))+120)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/2.2378828869411587))+120)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd4\']',2000,true,80,0,1);
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/37.858312521039835))+150)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/18.083839795990098))+150)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd5\']',2000,true,80,0,1);
</script>
<script>
/*
Scrolling Image Map/Text Link Tooltip Script-
Special Thanks to: Rob(http://rob.yeah.net)
Miss Ann(http://annworld.126.com)
*/
六 cookie脚本
1 随登录次数变
2集成cookie
脚本说明:
第一步:把如下代码加入<body>区域中
<SCRIPT language="JavaScript"><!--
function getCookieVal (offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function SetCookie (name, value)
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function ResetCounts(name)
{
visits = 0;
SetCookie("visits", visits, expdate , "java2000.wol.com.html", null, false);
location.reload();
}
//-->
</SCRIPT><br><SCRIPT language="JavaScript"><!--
var expdate = new Date();
var visits;
// Set expiration date to a year from now.
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
if(!(visits = GetCookie("visits")))
visits = 0;
visits++;
SetCookie("visits", visits, expdate, "java2000.wol.com.html", null, false);
if(visits == 1)
document.write('<P><CENTER>Welcome Cadet '+username+'</CENTER>');
if(visits == 2)
document.write('<P><CENTER>Welcome Ensign '+username+'</CENTER>');
if(visits == 3)
document.write('<P><CENTER>Welcome Lieutenant '+username+'</CENTER>');
if(visits == 4)
document.write('<P><CENTER>Welcome Lieutenant-Commander '+username+'</CENTER>');
if(visits == 5)
document.write('<P><CENTER>Welcome Commander '+username+'</CENTER>');
if(visits == 6)
document.write('<P><CENTER>Welcome Vice-Admiral '+username+'</CENTER>');
if(visits == 7)
document.write('<P><CENTER>Welcome Admiral '+username+'</CENTER>');
if(visits==
document.write('<P><CENTER>Welcome Demi-God '+username+'</CENTER>');
if(visits== 9)
document.write('<P><CENTER>Welcome Demi-God '+username+'</CENTER>');
if(visits>=10)
document.write('<P><CENTER>Welcome Master '+username+'</CENTER>');
//-->
</SCRIPT><br>
<FONT FACE=ARIAL size="2">
<b>Your access was granted from
<SCRIP
1字符从天而降
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language="JavaScript" FPTYPE="dynamicanimation8">
<!--
dynamicanimAttr = "dynamicanimation8"
animateElements = new Array()
currentElement = 0
speed = 0
stepsZoom = 8
stepsWord = 8
stepsFly = 12
stepsSpiral = 16
steps = stepsZoom
step = 0
outString = ""
function dynAnimation8()
{
var ms = navigator.appVersion.indexOf("MSIE")
ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4)
if(!ie4)
{
if((navigator.appName == "Netscape") &&
(parseInt(navigator.appVersion.substring(0, 1)) >= 4))
{
for (index=document.layers.length-1; index >= 0; index--)
{
layer=document.layers[index]
if (layer.left==10000)
layer.left=0
}
}
return
}
for (index=document.all.length-1; index >= document.body.sourceIndex; index--)
{
el = document.all[index]
animation = el.getAttribute(dynamicanimAttr, false)
if(null != animation)
{
if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord")
{
ih = el.innerHTML
outString = ""
i1 = 0
iend = ih.length
while(true)
{
i2 = startWord(ih, i1)
if(i2 == -1)
i2 = iend
outWord(ih, i1, i2, false, "")
if(i2 == iend)
break
i1 = i2
i2 = endWord(ih, i1)
if(i2 == -1)
i2 = iend
outWord(ih, i1, i2, true, animation)
if(i2 == iend)
break
i1 = i2
}
document.all[index].innerHTML = outString
document.all[index].style.posLeft = 0
document.all[index].setAttribute(dynamicanimAttr, null)
}
if(animation == "zoomIn" || animation == "zoomOut")
{
ih = el.innerHTML
outString = "<SPAN " + dynamicanimAttr + "=\"" + animation + "\" style=\"position: relative; left: 10000;\">"
outString += ih
outString += "</SPAN>"
document.all[index].innerHTML = outString
document.all[index].style.posLeft = 0
document.all[index].setAttribute(dynamicanimAttr, null)
}
}
}
i = 0
for (index=document.body.sourceIndex; index < document.all.length; index++)
{
el = document.all[index]
animation = el.getAttribute(dynamicanimAttr, false)
if (null != animation)
{
if(animation == "flyLeft")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = 0
}
else if(animation == "flyRight")
{
el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
el.style.posTop = 0
}
else if(animation == "flyTop" || animation == "dropWord")
{
el.style.posLeft = 0
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "flyBottom")
{
el.style.posLeft = 0
el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
}
else if(animation == "flyTopLeft")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "flyTopRight" || animation == "flyTopRightWord")
{
el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "flyBottomLeft")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
}
else if(animation == "flyBottomRight" || animation == "flyBottomRightWord")
{
el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
}
else if(animation == "spiral")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "zoomIn")
{
el.style.posLeft = 10000
el.style.posTop = 0
}
else if(animation == "zoomOut")
{
el.style.posLeft = 10000
el.style.posTop = 0
}
else
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = 0
}
el.initLeft = el.style.posLeft
el.initTop = el.style.posTop
animateElements[i++] = el
}
}
window.setTimeout("animate();", speed)
}
function offsetLeft(el)
{
x = el.offsetLeft
for (e = el.offsetParent; e; e = e.offsetParent)
x += e.offsetLeft;
return x
}
function offsetTop(el)
{
y = el.offsetTop
for (e = el.offsetParent; e; e = e.offsetParent)
y += e.offsetTop;
return y
}
function startWord(ih, i)
{
for(tag = false; i < ih.length; i++)
{
c = ih.charAt(i)
if(c == '<')
tag = true
if(!tag)
return i
if(c == '>')
tag = false
}
return -1
}
function endWord(ih, i)
{
nonSpace = false
space = false
while(i < ih.length)
{
c = ih.charAt(i)
if(c != ' ')
nonSpace = true
if(nonSpace && c == ' ')
space = true
if(c == '<')
return i
if(space && c != ' ')
return i
i++
}
return -1
}
function outWord(ih, i1, i2, dyn, anim)
{
if(dyn)
outString += "<SPAN " + dynamicanimAttr + "=\"" + anim + "\" style=\"position: relative; left: 10000;\">"
outString += ih.substring(i1, i2)
if(dyn)
outString += "</SPAN>"
}
function animate()
{
el = animateElements[currentElement]
animation = el.getAttribute(dynamicanimAttr, false)
step++
if(animation == "spiral")
{
steps = stepsSpiral
v = step/steps
rf = 1.0 - v
t = v * 2.0*Math.PI
rx = Math.max(Math.abs(el.initLeft), 200)
ry = Math.max(Math.abs(el.initTop), 200)
el.style.posLeft = Math.ceil(-rf*Math.cos(t)*rx)
el.style.posTop = Math.ceil(-rf*Math.sin(t)*ry)
}
else if(animation == "zoomIn")
{
steps = stepsZoom
el.style.fontSize = Math.ceil(50+50*step/steps) + "%"
el.style.posLeft = 0
}
else if(animation == "zoomOut")
{
steps = stepsZoom
el.style.fontSize = Math.ceil(100+200*(steps-step)/steps) + "%"
el.style.posLeft = 0
}
else
{
steps = stepsFly
if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord")
steps = stepsWord
dl = el.initLeft / steps
dt = el.initTop / steps
el.style.posLeft = el.style.posLeft - dl
el.style.posTop = el.style.posTop - dt
}
if (step >= steps)
{
el.style.posLeft = 0
el.style.posTop = 0
currentElement++
step = 0
}
if(currentElement < animateElements.length)
window.setTimeout("animate();", speed)
}
//-->
</SCRIPT>
第二步:把如下代码加入<body>区域中(也就是在页面中调用脚本)
<p dynamicanimation8="dropWord"
style="position: relative !important; left: 10000 !important" align="center"><font size="3" color="#ee00FF">很 好 玩 吧 ! 有 没 有 吓 一 跳 ?<font size="7"><b><font face="Arial, Helvetica, sans-serif" color="#FF0000">YES!
</font></b></font></font></p>
第三步:把<body>改为
<body onload="dynAnimation8()">
2打字机输出文字
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language="JavaScript">
<!--
var layers = document.layers, style = document.all, both = layers || style, idme=908601;
if (layers) { layerRef = 'document.layers'; styleRef = ''; } if (style) { layerRef = 'document.all'; styleRef = '.style'; }
function writeOnText(obj, str) {
if (layers) with (document[obj]) { document.open(); document.write(str); document.close(); }
if (style) eval(obj+'.innerHTML= str');
}
//以下是输出的内容,自己修改即可。
var dispStr = new Array(
"<font color=red size=3>欢迎光临精彩JavaScript世界...</font><br><font color=green size=3>你知道怎样在你的网页中做一个很酷的网页菜单吗?</font><br><font color=red size=3>你知道怎样让你的网页背景向上或向下移动吗?</font><br><font color=blue size=3>你知道怎样在你的主页中任意位置显示一个时钟吗?</font><br><font color=red size=3>你知道怎样在主页中做特效文字吗?</font><br><font color=black size=3>你知道怎样做一个很cool的日历吗?</font>"
);
var overMe=0;
function txtTyper(str, idx, idObj, spObj, clr1, clr2, delay, plysnd) {
var tmp0 = tmp1 = '', skip = 0;
if (both && idx <= str.length) {
if (str.charAt(idx) == '<') { while (str.charAt(idx) != '>') idx++; idx++; }
if (str.charAt(idx) == '&' && str.charAt(idx+1) != ' ') { while (str.charAt(idx) != ';') idx++; idx++; }
tmp0 = str.slice(0,idx);
tmp1 = str.charAt(idx++);
if (overMe==0 && plysnd==1) {
if (navigator.plugins[0]) {
if (navigator.plugins["LiveAudio"][0].type=="audio/basic" && navigator.javaEnabled()) {
document.embeds[0].stop();
setTimeout("document.embeds[0].play(false)",100); }
} else if (document.all) {
ding.Stop();
setTimeout("ding.Run()",100);
}
overMe=1;
} else overMe=0;
writeOnText(idObj, "<span class="+spObj+"><font color='"+clr1+"'>"+tmp0+"</font><font color='"+clr2+"'>"+tmp1+"</font></span>");
setTimeout("txtTyper('"+str+"', "+idx+", '"+idObj+"', '"+spObj+"', '"+clr1+"', '"+clr2+"', "+delay+" ,"+plysnd+")",delay);
}
}
function init() {
txtTyper(dispStr[0], 0, 'ttl0', 'ttl1', '#339933', '#99FF33', 50, 0);
}
// -->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<DIV class=ttl1 id=ttl0><SPAN class=ttl1></SPAN></DIV>
第三步:把<body>改为
<body onload="onload=init()">
3滚动显示的logo
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language="JavaScript">
<!--
var scrollerwidth=88
var scrollerheight=31
var scrollerbgcolor='white'
//每个图间暂停3秒。
var pausebetweenimages=3000
//边界下面的行,如果希望logo都是带连接的,只要加上<a>标签即可。
var slideimages=new Array()
slideimages[0]='<A href=http://bhysj.163.net/ target=_blank><IMG alt=痴人可不是傻子 border=0 height=31 src=chir.gif width=88></A>'
slideimages[1]='<A href=http://wjjader.126.com target=_blank><IMG alt=紫巾苑 border=0 height=31 src=zjlogo.gif width=88></A>'
slideimages[2]='<A href=http://hanyu2000.yeah.net/ target=_blank><IMG alt=碧空流云 border=0 height=31 src=bhlogo.gif width=88></A>'
slideimages[3]='<A href=http://tdyn.126.com target=_blank><IMG alt=天地有你 border=0 height=31 src=tdyn.gif width=88></A>'
slideimages[4]='<A href=http://teach.t500.net target=_blank><IMG alt=教师之家欢迎你 border=0 height=31 src=home2.gif width=88></A>'
//尽管填加更多的。
if (slideimages.length>1)
i=2
else
i=0
function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top>0&&tlayer.top<=5){
tlayer.top=0
setTimeout("move1(tlayer)",pausebetweenimages)
setTimeout("move2(document.main.document.second)",pausebetweenimages)
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout("move1(tlayer)",100)
}
else{
tlayer.top=scrollerheight
tlayer.document.write(slideimages[i])
tlayer.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}
function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
setTimeout("move2(tlayer2)",pausebetweenimages)
setTimeout("move1(document.main.document.first)",pausebetweenimages)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",100)
}
else{
tlayer2.top=scrollerheight
tlayer2.document.write(slideimages[i])
tlayer2.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}
function move3(whichdiv){
tdiv=eval(whichdiv)
if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=5){
tdiv.style.pixelTop=0
setTimeout("move3(tdiv)",pausebetweenimages)
setTimeout("move4(second2)",pausebetweenimages)
return
}
if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){
tdiv.style.pixelTop-=5
setTimeout("move3(tdiv)",100)
}
else{
tdiv.style.pixelTop=scrollerheight
tdiv.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function move4(whichdiv){
tdiv2=eval(whichdiv)
if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=5){
tdiv2.style.pixelTop=0
setTimeout("move4(tdiv2)",pausebetweenimages)
setTimeout("move3(first2)",pausebetweenimages)
return
}
if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){
tdiv2.style.pixelTop-=5
setTimeout("move4(second2)",100)
}
else{
tdiv2.style.pixelTop=scrollerheight
tdiv2.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function startscroll(){
if (document.all){
move3(first2)
second2.style.top=scrollerheight
}
else if (document.layers){
move1(document.main.document.first)
document.main.document.second.top=scrollerheight+5
document.main.document.second.visibility='show'
}
}
window.onload=startscroll
//-->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<ilayer id="main" width=&{scrollerwidth}; height=&{scrollerheight}; bgcolor=&{scrollerbgcolor};>
<layer id="first" left=0 top=1 width=&{scrollerwidth};>
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[0])
</script>
</layer>
<layer id="second" left=0 top=0 width=&{scrollerwidth}; visibility=hide>
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[1])
</script>
</layer>
</ilayer>
<p>
<SCRIPT language="JavaScript">
<!--
if (document.all){
document.writeln('<span id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hiden;background-color:'+scrollerbgcolor+'">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0;top:0">')
document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0;top:1;">')
document.write(slideimages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0;top:0">')
document.write(slideimages[1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</span>')
}
//-->
</SCRIPT>
4文本自动滚屏
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function selectScroller(n) {
optlist = document.scrollform.scroller;
optlist[optlist.length] = new Option(optlist[0].text, "", false, false);
optlist[0] = null;
optlist.selectedIndex = -1;
n = (n + 1) % optlist.length;
// change the speed below: 1000 = 1 second.
setTimeout("selectScroller("+n+")",2000);
}
// End -->
</script>
第二步:把如下代码加入<body>区域中
<form name="scrollform">
<select name="scroller" size=8>
<option>This select option list will
<option>scroll text by copying
<option>the top line to the bottom
<option>line before deleting the
<option>top line. This moves the
<option>options up one line and
<option>gives the impression of
<option>scrolling.
<option>
<option>You can leave as many
<option>blank lines as you feel
<option>necessary to give the
<option>look of begining and
<option>ending.
<option>
<option>This script was written
<option>in response to those
<option>who wanted a news
<option>scroller to work within
<option>a table's cell and for
<option>those who want old
<option>browsers to also see
<option>a scoller on the page.
<option>
<option>This select option list will
<option>scroll text by copying
<option>the top line to the bottom
<option>line before deleting the
<option>top line. This moves the
<option>options up one line and
<option>gives the impression of
<option>scrolling.
<option>
<option>You can leave as many
<option>blank lines as you feel
<option>necessary to give the
<option>look of begining and
<option>ending.
<option>
<option>This script was written
<option>in response to those
<option>who wanted a news
<option>scroller to work within
<option>a table's cell and for
<option>those who want old
<option>browsers to also see
<option>a scoller on the page.
<option>
<option>yobo42@hotmail.com
</select>
</form>
第三步:把<body>改为
<BODY OnLoad="selectScroller(0);">
5控制别人输入的字数
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
maxLen = 130; // max number of characters allowed
function checkMaxInput(form) {
if (form.message.value.length > maxLen) // if too long.... trim it!
form.message.value = form.message.value.substring(0, maxLen);
// otherwise, update 'characters left' counter
else form.remLen.value = maxLen - form.message.value.length;
}
// End -->
</script>
第二步:把如下代码加入<body>区域中
<form name=myform action="YOUR-SCRIPT.CGI">
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )<br>
<textarea name=message wrap=physical cols=28 rows=4 onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="130"> characters left</font>
</form>
6文本上下跳
脚本说明:
把如下代码加入<body>区域中
<script language="JavaScript">
<!--
done = 0;
step = 4
function anim(yp,yk)
{
if(document.layers) document.layers["napis"].top=yp;
else document.all["napis"].style.top=yp;
if(yp>yk) step = -4
if(yp<60) step = 4
setTimeout('anim('+(yp+step)+','+yk+')', 10);
}
function start()
{
if(done) return
done = 1;
if(navigator.appName=="Netscape") {
document.napis.left=innerWidth/2 - 145;
anim(60,innerHeight - 60)
}
else {
napis.style.left=280;
anim(60,document.body.offsetHeight - 60)
}
}
//-->
</script>
<div id="napis"
style="position: absolute; top: 159px; width: 400px; height: 78px; left: 215px"><font size="5"><b>上下不停弹跳的文本</b></font></div>
<script language="JavaScript">
<!--
setTimeout('start()',10);
//-->
</script>
7特酷消隐字体
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language="JavaScript">
<!--
var thissize=20
var textfont="隶书"
var textcolor= new Array()
textcolor[0]="000000"
textcolor[1]="000000"
textcolor[2]="000000"
textcolor[3]="111111"
textcolor[4]="222222"
textcolor[5]="333333"
textcolor[6]="444444"
textcolor[7]="555555"
textcolor[8]="666666"
textcolor[9]="777777"
textcolor[10]="888888"
textcolor[11]="999999"
textcolor[12]="aaaaaa"
textcolor[13]="bbbbbb"
textcolor[14]="cccccc"
textcolor[15]="dddddd"
textcolor[16]="eeeeee"
textcolor[17]="ffffff"
textcolor[18]="ffffff"
var message = new Array()
message[0]="欢迎光临超级JAVA酷"
message[1]="请多停留一会"
message[2]="你会有更多的收获"
message[3]="请再次光临"
i_message=0
var i_strength=0
var i_message=0
var timer
function glowtext() {
if(document.all) {
if (i_strength <=17) {
glowdiv.innerText=message[i_message]
document.all.glowdiv.style.filter="glow(color="+textcolor[i_strength]+", strength=4)"
i_strength++
timer=setTimeout("glowtext()",100)
}
else {
clearTimeout(timer)
setTimeout("deglowtext()",1500)
}
}
}
function deglowtext() {
if(document.all) {
if (i_strength >=0) {
glowdiv.innerText=message[i_message]
document.all.glowdiv.style.filter="glow(color="+textcolor[i_strength]+", strength=4)"
i_strength--
timer=setTimeout("deglowtext()",100)
}
else {
clearTimeout(timer)
i_message++
if (i_message>=message.length) {i_message=0}
i_strength=0
intermezzo()
}
}
}
function intermezzo() {
glowdiv.innerText=""
setTimeout("glowtext()",1000)
}
//-->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<div id="glowdiv" style="position:absolute;visibility:visible;width:600px;text-align:center; top:185px;left:70px;font-family:隶书;font-size:30pt;color:000000"></div>
第三步:把<body>区中内容改为
<body onLoad="glowtext()">
8文本框栏目介绍
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var messages = new Array(6);
messages[0] = "";
messages[1] = "Have you ever seen anything like this before?";
messages[2] = "Can you imagine how you could use it on your site?";
messages[3] = "It's great for sharing lots of information.";
messages[4] = "And doesn't take up much space! ";
messages[5] = "So, get the code and put it on your site!";
function messageReveal() {
var messageindex = document.messageForm.messagePick.selectedIndex
document.messageForm.messageField.value = messages[messageindex];
}
// End -->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<form name="messageForm">
<select name="messagePick" OnChange="messageReveal()">
<option value="0">The Menu Message
<option>Seen this before?
<option>Possible uses?
<option>Shares Information
<option>Saves space
<option>Get the code!
</select>
<br><p>
<textarea name="messageField" rows=6 cols=50 wrap=virtual></textarea>
</form>
二 页面导航类
脚本说明:
把如下代码加入<body>区域中
<script language=javascript>
<!--
var index = 9
link = new Array(8);
text = new Array(8);
link[0] ='time1.htm'
link[1] ='time2.htm'
link[2] ='time3.htm'
link[3] ='time1.htm'
link[4] ='time2.htm'
link[5] ='time3.htm'
link[6] ='time1.htm'
link[7] ='time2.htm'
link[8] ='time3.htm'
text[0] ='说明一'
text[1] ='说明一'
text[2] ='说明一'
text[3] ='说明一'
text[4] ='说明一'
text[5] ='说明一'
text[6] ='说明一'
text[7] ='说明一'
text[8] ='说明一'
document.write ("<marquee scrollamount='1' scrolldelay='100' direction= 'up' width='150' height='150'>");
for (i=0;i<index;i++){
document.write (" <img src='arrow.gif' width='12' height='12'><a href="+link[i]+" target='_blank'>");
document.write (text[i] + "</A><br>");
}
document.write ("</marquee>")
// -->
</script>
3友情链接导航
脚本说明:
把如下代码加入<body>区域中(你可以对链接及说明作相应修改)
<script language="JavaScript"><!-- Hide function surfto(form) { var myindex=form.dest.selectedIndex location=form.dest.options[myindex].value;}//--></SCRIPT><FORM NAME="myform"> <SELECT NAME="dest" SIZE=4> <OPTION SELECTED VALUE="">选项<OPTION VALUE="search.htm">搜索引擎 <OPTION VALUE="chat.htm">聊天 </SELECT><INPUT TYPE="BUTTON" VALUE="GO NOW!" onClick="surfto(this.form)"></FORM>
4重要信息显示
脚本说明:
第一步:把如下代码加入<body>区域中
<script language="javascript">
//显示的信息,可以使用HTML语法,注意引号用法,单套双。
var message='<b><font size=5 face=arial color=red><a href="http://vs_server.njcatv.net/bbs" target="_blank">请点击进入本站BBS</a></font></b>'
//背景色
var backgroundcolor="#eeffee"
//0 代表信息永远显示,1 代表信息只显示一段时间,2为随机显示模式;
var displaymode=1
//如果显示模式为在指定时间内显示,输入时间段(1000为1秒);
var displayduration=30000
//1代表闪烁,0代表不闪烁;
var flashmode=1
//如果设置了闪烁,输入闪烁的颜色;
var flashtocolor="lightgreen"
////下面不必修改///
function regenerate(){
window.location.reload()
}
var which=0
function regenerate2(){
if (document.layers)
setTimeout("window.onresize=regenerate",400)
}
function display2(){
if (document.layers){
if (topmsg.visibility=="show")
topmsg.visibility="hide"
else
topmsg.visibility="show"
}
else if (document.all){
if (topmsg.style.visibility=="visible")
topmsg.style.visibility="hidden"
else
topmsg.style.visibility="visible"
setTimeout("display2()",Math.round(Math.random()*10000)+10000)
}
}
function flash(){
if (which==0){
if (document.layers)
topmsg.bgColor=flashtocolor
else
topmsg.style.backgroundColor=flashtocolor
which=1
}
else{
if (document.layers)
topmsg.bgColor=backgroundcolor
else
topmsg.style.backgroundColor=backgroundcolor
which=0
}
}
if (document.all){
document.write('<span id="topmsg" style="position:absolute;visibility:hidden">'+message+'</span>')
}
function logoit(){
document.all.topmsg.style.left=document.body.scrollLeft+document.body.clientWidth/2-document.all.topmsg.offsetWidth/2
document.all.topmsg.style.top=document.body.scrollTop+document.body.clientHeight-document.all.topmsg.offsetHeight-4
}
function logoit2(){
topmsg.left=pageXOffset+window.innerWidth/2-topmsg.document.width/2
topmsg.top=pageYOffset+window.innerHeight-topmsg.document.height-5
setTimeout("logoit2()",90)
}
function setmessage(){
document.all.topmsg.style.left=document.body.scrollLeft+document.body.clientWidth/2-document.all.topmsg.offsetWidth/2
document.all.topmsg.style.top=document.body.scrollTop+document.body.clientHeight-document.all.topmsg.offsetHeight-4
document.all.topmsg.style.backgroundColor=backgroundcolor
document.all.topmsg.style.visibility="visible"
if (displaymode==1)
setTimeout("topmsg.style.visibility='hidden'",displayduration)
else if (displaymode==2)
display2()
if (flashmode==1)
setInterval("flash()",1000)
window.onscroll=logoit
window.onresize=new Function("window.location.reload()")
}
function setmessage2(){
topmsg=new Layer(window.innerWidth)
topmsg.bgColor=backgroundcolor
regenerate2()
topmsg.document.write(message)
topmsg.document.close()
logoit2()
topmsg.visibility="show"
if (displaymode==1)
setTimeout("topmsg.visibility='hide'",displayduration)
else if (displaymode==2)
display2()
if (flashmode==1)
setInterval("flash()",1000)
}
if (document.layers)
window.onload=setmessage2
else if (document.all)
window.onload=setmessage
</script>
6不停变化的导航
脚本说明:
第一步:把如下代码加入<head>区域中(你可以对链接及说明作相应修改)
<SCRIPT LANGUAGE="JavaScript">
<!-- begin
// please help yourself to this code.
var startTime =null;
var timerID =null;
var initial =new Date();
var pos =0;
var menuItem =null;
function initArray() {
this.length = initArray.arguments.length
for (var i = 0; i < this.length; i++) {
this[i+1] = initArray.arguments[i]
}
}
function parsemenuItem(data,num) {
for(var i=0;i<data.length;i++) {
if(data.substring(i,i+1)=="|") break;
}
if (num==0) return(data.substring(0,i));
else return(data.substring(i+1,data.length));
}
function startTimer() {
initial = new Date();
startTime=initial.getTime();
stopTimer();
menuItem = new initArray("Netscape|http://www.netscape.com",
"Microsoft|http://www.microsoft.com",
"IBM|http://www.ibm.com",
"Yahoo|http://www.yahoo.com",
"Excite|http://www.excite.com",
"Hotbot|http://www.hotbot.com",
"GrapeJam|http://www.grapejam.com",
"Email|mailto:rzeitel@mars.superlink.net"
);
showTimer();
}
function stopTimer() {
timerID=null;
menuItem=null;
//clearTimeout(timerID);
}
function showTimer() {
pos= (pos == menuItem.length) ? 1 : pos + 1;
document.forms[0].elements[0].value=parsemenuItem(menuItem[pos],0);
timerID=window.setTimeout('showTimer()',4000);
}
function goToUrl() {
//parent.welcome.location=parsemenuItem(menuItem[pos],1);
this.location=parsemenuItem(menuItem[pos],1);
return (false);
}
// end -->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<FORM>
<INPUT TYPE="button" VALUE=" WHERE TO? " NAME="goTo"
onClick="window.goToUrl()">
</FORM>
第三步:把<body>中的内容改为:
<body onLoad="window.startTimer()">
三 背景颜色类
1 背景颜色安全测试
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language=javascript>
<!--
function makeArray(q){for(i=1;i<=q;i++){this[i]=0}}Colors=new makeArray(7);Colors[1]="00";Colors[2]="33";Colors[3]="66";Colors[4]="99";Colors[5]="CC";Colors[6]="FF";
-->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<center><table cellspacing=0 cellpadding=0><SCRIPT language=javascript>
<!--
for(i=1;i<=6;i++){for(j=1;j<=6;j++){for(k=1;k<=6;k++){var thiscolor=Colors[i]+Colors[j]+Colors[k];document.writeln("<tr><td height = 20 bgcolor = \"#" + thiscolor + "\" align = right><a href = ");document.writeln("\'\' onMouseOver = \"document.bgColor=\'"+thiscolor+"\'\">"+thiscolor+"</a></td></tr>");}}}
-->
</SCRIPT></table></center>
2 礼花背景
脚本说明:
把如下代码加入<body>区域中
<layer name="a0" left=10 top=10 visibility=show bgcolor="#ffffff" clip="0,0,1,1"></layer>
<layer name="a1" left=10 top=10 visibility=show bgcolor="#fff000" clip="0,0,1,1"></layer>
<layer name="a2" left=10 top=10 visibility=show bgcolor="#ffa000" clip="0,0,1,1"></layer>
<layer name="a3" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>
<layer name="a4" left=10 top=10 visibility=show bgcolor="#00ff00" clip="0,0,1,1"></layer>
<layer name="a5" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>
<layer name="a6" left=10 top=10 visibility=show bgcolor="#ff0000" clip="0,0,1,1"></layer>
<layer name="a7" left=10 top=10 visibility=show bgcolor="#ffffff" clip="0,0,1,1"></layer>
<layer name="a8" left=10 top=10 visibility=show bgcolor="#fff000" clip="0,0,1,1"></layer>
<layer name="a9" left=10 top=10 visibility=show bgcolor="#ffa000" clip="0,0,1,1"></layer>
<layer name="a10" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>
<layer name="a11" left=10 top=10 visibility=show bgcolor="#00ff00" clip="0,0,2,2"></layer>
<layer name="a12" left=10 top=10 visibility=show bgcolor="#0000ff" clip="0,0,2,2"></layer>
<layer name="a13" left=10 top=10 visibility=show bgcolor="#ff0000" clip="0,0,2,2"></layer>
<div id="starsDiv" style="position:absolute;top:0px;left:0px">
<div style="position:relative;width:2px;height:2px;background:#ffffff;font-size:2px"></div>
<div style="position:relative;width:1px;height:1px;background:#fff000;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#ffa000;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#ff00ff;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#00ff00;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#0000ff;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#FF0000;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#ffffff;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#fff000;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#ffa000;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#ff00ff;font-size:1px"></div>
<div style="position:relative;width:2px;height:2px;background:#ff00ff;font-size:2px"></div>
<div style="position:relative;width:1px;height:1px;background:#0000ff;font-size:1px"></div>
<div style="position:relative;width:1px;height:1px;background:#FF0000;font-size:1px"></div>
</div>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var Clrs = new Array(9);
Clrs[0] = 'ff0000';
Clrs[1] = '00ff00';
Clrs[2] = '000aff';
Clrs[3] = 'ff00ff';
Clrs[4] = 'ffa500';
Clrs[5] = 'ffff00';
Clrs[6] = '00ff00';
Clrs[7] = 'ffffff';
Clrs[8] = 'fffff0';
var sClrs = new Array(5);
sClrs[0] = 'ffa500';
sClrs[1] = '55ff66';
sClrs[2] = 'AC9DFC';
sClrs[3] = 'fff000';
sClrs[4] = 'fffff0';
var yBase;
var xBase;
var step;
var currStep = 0;
var Xpos = 1;
var Ypos = 1;
var initialStarColor = 'ffa000';
var Mtop = 250;
var Mleft = 250;
function Fireworks() {
if (document.all) {
yBase = window.document.body.offsetHeight / 3;
xBase = window.document.body.offsetWidth / 8;
}
else if (document.layers) {
yBase = window.innerHeight / 3;
xBase = window.innerWidth / 8;
}
if (document.all) {
step = 5;
for ( i = 0 ; i < starsDiv.all.length ; i++ ) {
for (ai = 0; ai < Clrs.length; ai++) {
var c = Math.round(Math.random()*[ai]);
}
if (currStep < 90)
starsDiv.all[i].style.background=initialStarColor;
if (currStep > 90)
starsDiv.all[i].style.background=Clrs[c];
starsDiv.all[i].style.top = Mtop + yBase*Math.sin((currStep+i*5)/3)*Math.sin(550+currStep/100)
starsDiv.all[i].style.left = Mleft + yBase*Math.cos((currStep+i*5)/3)*Math.sin(550+currStep/100)
}
}
else if (document.layers) {
step = 5;
for ( j = 0 ; j < 24 ; j++ ) { //number of NS layers!
var templayer = "a"+j;
for (ai = 0; ai < Clrs.length; ai++) {
var c = Math.round(Math.random()*[ai]);
}
if (currStep < 90)
document.layers[templayer].bgColor=initialStarColor;
if (currStep > 90)
document.layers[templayer].bgColor=Clrs[c];
document.layers[templayer].top = Mtop + yBase*Math.sin((currStep+j*5)/3)*Math.sin(550+currStep/100)
document.layers[templayer].left = Mleft + yBase*Math.cos((currStep+j*5)/3)*Math.sin(550+currStep/100)
}
}
currStep+= step;
T=setTimeout("Fireworks()",5);
if (currStep == 220) {
currStep = -10;
for (n = 0; n < sClrs.length; n++) {
var k = Math.round(Math.random()*n);
}
initialStarColor = sClrs[k];
if (document.all) {
Dtop = window.document.body.clientHeight - 250;
Dleft = xBase * 3.5;
Mtop = Math.round(Math.random()*Dtop);
Mleft = Math.round(Math.random()*Dleft);
document.all.starsDiv.style.top = Mtop+document.body.scrollTop;
document.all.starsDiv.style.left = Mleft+document.body.scrollLeft;
}
else if (document.layers) {
Dleft = window.innerWidth - 100;
Dtop = window.innerHeight - 100;
Mtop = Math.round(Math.random()*Dtop+window.pageYOffset);
Mleft = Math.round(Math.random()*Dleft+window.pageXOffset);
document.layers[templayer].top = Mtop;
document.layers[templayer].left = Mleft;
}
if ((Mtop < 20) || (Mleft < 20)) {
Mtop += 90;
Mleft += 90;
}
}
}
Fireworks();
// End -->
</script>
3 手动调色
脚本说明:
把如下代码加入<body>区域中
<script language="JavaScript">
<!-- Hiding
var red=0;
var green=0;
var blue=0;
var value=0;
var convert = new Array()
var hexbase= new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");
for (x=0; x<16; x++){
for (y=0; y<16; y++){
convert[value]= hexbase[x] + hexbase[y];
value++;
}
}
function clear(){
document.color.bl.value= blue;
document.color.rd.value= red;
document.color.gr.value= green;
}
function display(){
redx = convert[red]
greenx = convert[green]
bluex = convert[blue]
var rgb = "#"+redx+greenx+bluex;
document.color.rgbdspl.value= rgb;
document.bgColor =rgb;
}
function upred(x){
if ((red+x)<=255)
red+=x
document.color.rd.value= red;
display()
}
function downred(x){
if ((red-x)>=0)
red-=x
document.color.rd.value= red;
display()
}
function upgreen(x){
if ((green+x)<=255)
green+=x
document.color.gr.value= green;
display()
}
function downgreen(x){
if ((green-x)>=0)
green-=x
document.color.gr.value= green;
display()
}
function upblue(x){
if ((blue+x)<=255)
blue+=x
document.color.bl.value= blue;
display()
}
function downblue(x){
if ((blue-x)>=0)
blue-=x
document.color.bl.value= blue;
display()
}
// done hiding -->
</script>
<form name="color">
<table>
<tr align="Center">
<td>
<input name="red" type="button" value=" +50 " onClick="upred(50)">
</td>
<td>
<input name="red2" type="button" value=" + 10 " onClick="upred(10)">
</td>
<td>
<input name="red2" type="button" value=" + 1" onClick="upred(1)">
</td>
<td width="50"><font color="#FF0000" size=+3><b><font color="#FA0000">红</font></b></font></td>
<td>
<input name="red-" type="button" value=" - 1" onClick="downred(1)">
</td>
<td>
<input name="red-" type="button" value=" - 10 " onClick="downred(10)">
</td>
<td>
<input name="red-" type="button" value=" -50 " onClick="downred(50)">
</td>
<td>
<input type="text" name="rd" size=3>
</td>
</tr>
<tr align="Center">
<td>
<input name="green" type="button" value=" +50 " onClick="upgreen(50)">
</td>
<td>
<input name="green" type="button" value=" + 10 " onClick="upgreen(10)">
</td>
<td>
<input name="green" type="button" value=" + 1" onClick="upgreen(1)">
</td>
<td width="50"><font color="#00FF00" size=+3><b><font color="#00FA00">绿</font></b></font></td>
<td>
<input name="green-" type="button" value=" - 1" onClick="downgreen(1)">
</td>
<td>
<input name="green-" type="button" value=" - 10 " onClick="downgreen(10)">
</td>
<td>
<input name="green-" type="button" value=" -50 " onClick="downgreen(50)">
</td>
<td>
<input type="text" name="gr" size=3>
</td>
</tr>
<tr align="Center">
<td>
<input name="blue" type="button" value=" +50 " onClick="upblue(50)">
</td>
<td>
<input name="blue" type="button" value=" + 10 " onClick="upblue(10)">
</td>
<td>
<input name="blue" type="button" value=" + 1" onClick="upblue(1)">
</td>
<td width="50"><font color="#0000FF" size=+3><b><font color="#0000FA">蓝</font></b></font></td>
<td>
<input name="blue-" type="button" value=" - 1" onClick="downblue(1)">
</td>
<td>
<input name="blue-" type="button" value=" - 10 " onClick="downblue(10)">
</td>
<td>
<input name="blue-" type="button" value=" -50 " onClick="downblue(50)">
</td>
<td>
<input type="text" name="bl" size=3>
</td>
</tr>
<tr align="Center">
<td> </td>
<td> </td>
<td> </td>
<td width="50">
<input type="text" name="rgbdspl" size=7>
</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</form>
4下雨
脚本说明:
把如下代码加入<body>区域中
<script language="JavaScript">
<!--
var no = 50;
var speed = 1;
var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;
var s, x, y, sn, cs;
var a, r, cx, cy;
var i, doc_width = 800, doc_height = 600;
if (ns4up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
}
else
if (ie4up) {
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
x = new Array();
y = new Array();
r = new Array();
cx = new Array();
cy = new Array();
s = 8;
for (i = 0; i < no; ++ i) {
initRain();
if (ns4up) {
if (i == 0) {
document.write("<layer name=\"dot"+ i +"\" left=\"1\" ");
document.write("top=\"1\" visibility=\"show\"><font color=\"red\">");
document.write(",</font></layer>");
}
else {
document.write("<layer name=\"dot"+ i +"\" left=\"1\" ");
document.write("top=\"1\" visibility=\"show\"><font color=\"red\">");
document.write(",</font></layer>");
}
}
else
if (ie4up) {
if (i == 0) {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write("visible; TOP: 15px; LEFT: 15px;\"><font color=\"red\">");
document.write(",</font></div>");
}
else {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write("visible; TOP: 15px; LEFT: 15px;\"><font color=\"red\">");
document.write(",</font></div>");
}
}
}
function initRain() {
a = 6;
r[i] = 1;
sn = Math.sin(a);
cs = Math.cos(a);
cx[i] = Math.random() * doc_width + 1;
cy[i] = Math.random() * doc_height + 1;
x[i] = r[i] * sn + cx[i];
y[i] = cy[i];
}
function makeRain() {
r[i] = 1;
cx[i] = Math.random() * doc_width + 1;
cy[i] = 1;
x[i] = r[i] * sn + cx[i];
y[i] = r[i] * cs + cy[i];
}
function updateRain() {
r[i] += s;
x[i] = r[i] * sn + cx[i];
y[i] = r[i] * cs + cy[i];
}
function raindropNS() {
for (i = 0; i < no; ++ i) {
updateRain();
if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) {
makeRain();
doc_width = self.innerWidth;
doc_height = self.innerHeight;
}
document.layers["dot"+i].top = y[i];
document.layers["dot"+i].left = x[i];
}
setTimeout("raindropNS()", speed);
}
function raindropIE() {
for (i = 0; i < no; ++ i) {
updateRain();
if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) {
makeRain();
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
document.all["dot"+i].style.pixelTop = y[i];
document.all["dot"+i].style.pixelLeft = x[i];
}
setTimeout("raindropIE()", speed);
}
if (ns4up) {
raindropNS();
}
else
if (ie4up) {
raindropIE();
}
-->
</script>
5按钮驱动背景
脚本说明:
把如下代码加入<body>区域中:
<script language="JavaScript">
var COLOR = 999999
var woot = 0
function stoploop()
{
document.bgColor = '#336699';
clearTimeout(loopID);
}
function loopBackground()
{
if (COLOR > 0)
{
document.bgColor = '#' + COLOR
COLOR -= 111111
loopID = setTimeout("loopBackground()",1)
}
else
{
document.bgColor = '#336699'
woot += 10
COLOR = 999999
COLOR -= woot
loopID = setTimeout("loopBackground()",1)
}
}
</script>
<input type="button" value="Start bgColor WARP" onClick="loopBackground()"><br>
<input type="button" value=" Stop bgColor WARP" onClick="stoploop()">
四 按钮特效类
1 死机代码
2 关不掉页面
脚本说明:
把如下代码加入<body>区域中:
<input type=button value=hmm onClick="var e=1;while(1==1){alert('你是关不掉我的!!!')}">
3 循环警告 ,关不掉浏览器
脚本说明:
把如下代码加入<body>区域中:
<script>
<!-- Script by Juan Valdez
function hate()
{
alert(' from ');
alert(' what');
alert(' you');
alert(' can');
alert(' see');
alert(' this');
alert(' is');
alert(' annoying');
return hate()
}
//-- done -->
</script>
<a href="javascript:hate()" onmouseover="window.status='按了可就关不掉了!';return true">
<b>最好别按</b></a>
4窗口抖动 ///// ***********
脚本说明:
把如下代码加入<body>区域中:
<script language="JavaScript">
<!--
function surfto(form) {
var myindex=form.select1.selectedIndex
if (form.select1.options[myindex].value != null) {
parent.main.location.href=form.select1.options[myindex].value;
}
}
// -->
</script>
<script language="JavaScript1.2">
<!--
function shake(n) {
if (window.top.moveBy) {
for (i = 10; i > 0; i--) {
for (j = n; j > 0; j--) {
window.top.moveBy(0,i);
window.top.moveBy(i,0);
window.top.moveBy(0,-i);
window.top.moveBy(-i,0);
}
}
}
alert(" 没吓坏吧!!! ");
}
// End -->
</script>
<script
language="JavaScript">
<!--
function moyamoya(htmlfile) {
parent.main.location.href=htmlfile;
}
// -->
</script>
<form>
<div align="center"><center><p><input onclick="shake(2)" type="button"
value="地震拉!!!"> </p>
</center></div>
</form>
5页面被冻结
脚本说明:
把如下代码加入<body>区域中
<script>
function freeze(){
alert ('对不起,你死机了,哈哈!!!');while(true){window.history.back(-1)}}
</script>
<FORM>
<INPUT TYPE="BUTTON" VALUE="Freeze" onClick="freeze()">
</FORM>
五 鼠标事件类
1图片跟随鼠标
脚本说明:
第一步:把如下代码加入<body>区域中
<SCRIPT LANGUAGE="JavaScript">
var newtop=0
var newleft=0
if (navigator.appName == "Netscape") {
layerStyleRef="layer.";
layerRef="document.layers";
styleSwitch="";
}
else
{
layerStyleRef="layer.style.";
layerRef="document.all";
styleSwitch=".style";
}
function doMouseMove() {
layerName = 'iit'
eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')
eval('curElement'+styleSwitch+'.visibility="visible"')
eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')
eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')
eval('height=curElement'+styleSwitch+'.height')
eval('width=curElement'+styleSwitch+'.width')
width=parseInt(width)
height=parseInt(height)
if (event.clientX > (document.body.clientWidth - 5 - width))
{
newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width
}
else
{
newleft=document.body.scrollLeft + event.clientX
}
eval('curElement'+styleSwitch+'.pixelLeft=newleft')
if (event.clientY > (document.body.clientHeight - 5 - height))
{
newtop=document.body.clientHeight + document.body.scrollTop - 5 - height
}
else
{
newtop=document.body.scrollTop + event.clientY
}
eval('curElement'+styleSwitch+'.pixelTop=newtop')
}
document.onmousemove = doMouseMove;
</SCRIPT>
第二步:把如下代码加入<body>区域中
<script language="javascript">
if (navigator.appName == "Netscape") {
}
else
{
document.write('<div ID=OuterDiv>')
document.write('<img ID=iit src="image1.gif" STYLE="position:absolute;TOP:0pt;LEFT:0pt;width=103;height=28;Z-INDEX:2;visibility:hidden;">')
document.write('</div>')
}
</script>
2禁用左键
脚本说明:
把如下代码加入<head>区域中
<script language="javascript">
function click() {
if (event.button==1) { //改成button==2为禁止右键
alert('对不起,禁止使用此功能.')
}
}
document.onmousedown=click
</script>
3 鼠标点击效果
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
var ver = navigator.appVersion;
var dom = document.getElementById ? 1 : 0;
var ie5 = (ver.indexOf("MSIE 5") > -1 && dom) ? 1 : 0;
var n = (document.layers);
var ie = (document.all);
var sparksAflyin = 0;
var totalSparks = 0;
var sparksOn = 1;
function initMouseEvents() {
document.onmousedown = mouseDown;
if (n) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
}
function mouseDown(e) {
if (sparksOn) {
var mousex = (n) ? e.pageX : event.x+document.body.scrollLeft;
var mousey = (n) ? e.pageY : event.y+document.body.scrollTop;
if (!sparksAflyin) {
for (var k = 0; k <= 9; k++)
eval('SHOW("sDiv'+k+'")');
sparksAflyin = 1;
totalSparks = 0;
for(i = 0;i <= 9; i++)
eval('moveTo('+i+',0,'+mousex+','+mousey+')');
}
}
}
function moveTo(i,j, mousex, mousey){
if (j < eval('anim_'+i+'_x.length') ){
var tempx = eval('anim_'+i+'_x[j]+mousex');
var tempy = eval('anim_'+i+'_y[j]+mousey');
if (ie) {
if(tempy+30 > (document.body.offsetHeight+document.body.scrollTop))
tempy = document.body.offsetHeight+document.body.scrollTop-30;
if(tempx+30 > (document.body.offsetWidth+document.body.scrollLeft))
tempx = document.body.offsetWidth+document.body.scrollLeft-30;
eval('document.all.sDiv'+i+'.style.left = tempx;');
eval('document.all.sDiv'+i+'.style.top = tempy;');
}
if (n) {
eval('document.layers.sDiv'+i+'.left = tempx;');
eval('document.layers.sDiv'+i+'.top = tempy;');
}
j++;
// timeout: 50 = fireworks speed, larger number = slower speed
setTimeout("moveTo("+i+","+j+","+mousex+","+mousey+")",50)
}
else {
eval('HIDE("sDiv'+i+'")');
totalSparks++;
}
if (totalSparks == 10) {
sparksAflyin = 0;
totalSparks = 0;
}
}
function SHOW(divName){
if (document.all)
eval('document.all.'+divName+'.style.visibility = "visible";');
else if (document.layers)
eval('document.layers["'+divName+'"].visibility = "visible";');
}
function HIDE(divName){
if (document.all)
eval('document.all.'+divName+'.style.visibility = "hidden";');
else if (document.layers)
eval('document.layers["'+divName+'"].visibility = "hide";');
}
anim_0_x=new Array(20,20,10,0,0,0,0,0,0,0,0,0);
anim_0_y=new Array(-20,-40,-60,-80,-60,-40,-20,0,20,40,60,80);
anim_1_x=new Array(20,20,17,36,60,78,90,92,93,98,108,120,133,152,181);
anim_1_y=new Array(-20,-20,-33,-38,-38,-27,-2,25,51,84,113,141,162,212,253);
anim_2_x=new Array(20,20,2,3,4,5,6,7,8,9,10,12,13,15,18);
anim_2_y=new Array(-20,-20,-33,-38,-38,-27,-2,25,51,84,113,141,162,212,253);
anim_3_x=new Array(-20,-20,-2,-1,7,10,18,35,60,102,94,94,93,97,108,111,117,127);
anim_3_y=new Array(-20,-25,-64,-89,-104,-150,-173,-197,-213,-199,-151,-101,-66,-17,27,87,140,189);
anim_4_x=new Array(-20,-20,-10,-39,-30,-69,-64,-138,-154,-200,-181,-209,-191,-207,-203,-213,-202,-221,-211);
anim_4_y=new Array(-20,-20,-28,-51,-79,-100,-135,-154,-193,-183,-149,-134,-89,-60,8,51,107,157,201);
anim_5_x=new Array(-20,-29,-51,-72,-105,-133,-164,-189,-209,-229,-247,-270,-279,-282,-283,-283,-285,-286,-288);
anim_5_y=new Array(-20,-55,-86,-116,-154,-183,-205,-217,-217,-198,-169,-120,-44,-8,40,87,144,190,248);
anim_6_x=new Array(-20,-20,-7,14,44,79,143,186,217,226,234,244,250,259,265,274);
anim_6_y=new Array(-20,-21,-72,-113,-139,-166,-188,-181,-126,-68,-3,54,134,187,215,257);
anim_7_x=new Array(20,20,-3,-9,-13,-27,-33,-44,-54,-66,-77,-95,-107,-136,-150,-160,-164,-168,-171,-172,-172,-176,-175);
anim_7_y=new Array(-20,-26,-43,-63,-89,-116,-145,-169,-201,-222,-240,-253,-254,-245,-220,-195,-160,-124,-81,-53,-26,19,68);
anim_8_x=new Array(-20,20,-35,39,0,45,-1,24,-15,14,-20,35,-18,38,-11,16,49,64,81,93,100,103,109);
anim_8_y=new Array(-20,-20,-32,-42,-62,-76,-89,-107,-132,-147,-173,-180,-192,-209,-236,-193,-119,-73,-24,51,95,130,188);
anim_9_x=new Array(-20,-51,-89,-110,-165,-191,-228,-240,-259,-271,-277,-281,-287);
anim_9_y=new Array(-20,-20,-35,-37,-34,-16,10,47,105,150,189,227,273);
// End -->
</script>
第二步:把<body>改为
<body OnLoad="initMouseEvents()">
第三步:在<body>区域中加入如下代码
<div id="sparks">
<div id="sDiv0" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">a</font></div>
<div id="sDiv1" style="position:absolute; visibility: hidden;"><font face="arial black" color="yellow">b</font></div>
<div id="sDiv2" style="position:absolute; visibility: hidden;"><font face="arial black" color="blue">c</font></div>
<div id="sDiv3" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">d</font></div>
<div id="sDiv4" style="position:absolute; visibility: hidden;"><font face="arial black" color="orange">e</font></div>
<div id="sDiv5" style="position:absolute; visibility: hidden;"><font face="arial black" color="white">f</font></div>
<div id="sDiv6" style="position:absolute; visibility: hidden;"><font face="arial black" color="green">g</font></div>
<div id="sDiv7" style="position:absolute; visibility: hidden;"><font face="arial black" color="skyblue">h</font></div>
<div id="sDiv8" style="position:absolute; visibility: hidden;"><font face="arial black" color="yellow">i</font></div>
<div id="sDiv9" style="position:absolute; visibility: hidden;"><font face="arial black" color="white">j</font></div>
</div>
4鼠标跟踪器
脚本说明:
把如下代码加入<body>区域中
<SCRIPT language="JavaScript">
<!--
B=document.all;
C=document.layers;
T1=new Array("trail1.gif",38,35,"trail2.gif",30,31,"trail3.gif",28,26,"trail4.gif",22,21,"trail5.gif",16,16)
nos=parseInt(T1.length/3)
rate=50
ie5fix1=0;
ie5fix2=0;
for (i=0;i<nos;i++){
createContainer("CUR"+i,i*10,i*10,i*3+1,i*3+2,"","<img src='"+T1[i*3]+"' width="+T1[(i*3+1)]+" height="+T1[(i*3+2)]+" border=0>")}
function createContainer(N,Xp,Yp,W,H,At,HT,Op,St){
with (document){
write((!B) ? "<layer id='"+N+"' left="+Xp+" top="+Yp+" width="+W+" height="+H : "<div id='"+N+"'"+" style='position:absolute;left:"+Xp+"; top:"+Yp+"; width:"+W+"; height:"+H+"; ");
if(St){
if (C)
write(" style='");
write(St+";' ")
}
else write((B)?"'":"");
write((At)? At+">" : ">");
write((HT) ? HT : "");
if (!Op)
closeContainer(N)
}
}
function closeContainer(){
document.write((B)?"</div>":"</layer>")
}
function getXpos(N){
return (B) ? parseInt(B[N].style.left) : C[N].left
}
function getYpos(N){
return (B) ? parseInt(B[N].style.top) : C[N].top
}
function moveContainer(N,DX,DY){
c=(B) ? B[N].style :C[N];c.left=DX;c.top=DY
}
function cycle(){
//if (IE5)
if (document.all&&window.print){
ie5fix1=document.body.scrollLeft;
ie5fix2=document.body.scrollTop;
}
for (i=0;i<(nos-1);i++){
moveContainer("CUR"+i,getXpos("CUR"+(i+1)),getYpos("CUR"+(i+1)))
}
}
function newPos(e){
moveContainer("CUR"+(nos-1),(B)?event.clientX+ie5fix1:e.pageX+2,(B)?event.clientY+ie5fix2:e.pageY+2
)
}
if(document.layers)
document.captureEvents(Event.MOUSEMOVE)
document.onmousemove=newPos
setInterval("cycle()",rate)
//-->
</SCRIPT>
6跟随鼠标的星星
脚本说明:
把如下代码加入<body>区域中
<script>
/*
Scrolling Image Map/Text Link Tooltip Script-
Special Thanks to: Rob(http://rob.yeah.net)
Miss Ann(http://annworld.126.com)
*/
if (!document.layers&&!document.all)
event="test"
function showtip2(current,e,text){
if (document.all&&document.readyState=="complete"){
document.all.tooltip2.innerHTML='<marquee style="border:1px solid black">'+text+'</marquee>'
document.all.tooltip2.style.pixelLeft=event.clientX+document.body.scrollLeft+10
document.all.tooltip2.style.pixelTop=event.clientY+document.body.scrollTop+10
document.all.tooltip2.style.visibility="visible"
}
else if (document.layers){
document.tooltip2.document.nstip.document.write('<b>'+text+'</b>')
document.tooltip2.document.nstip.document.close()
document.tooltip2.document.nstip.left=0
currentscroll=setInterval("scrolltip()",100)
document.tooltip2.left=e.pageX+10
document.tooltip2.top=e.pageY+10
document.tooltip2.visibility="show"
}
}
function hidetip2(){
if (document.all)
document.all.tooltip2.style.visibility="hidden"
else if (document.layers){
clearInterval(currentscroll)
document.tooltip2.visibility="hidden"
}
}
function scrolltip(){
if (document.tooltip2.document.nstip.left>=-document.tooltip2.document.nstip.document.width)
document.tooltip2.document.nstip.left-=5
else
document.tooltip2.document.nstip.left=150
}
</script>
<script language="JavaScript">
function YY_Layerfx(yyleft,yytop,yyfnx,yyfny,yydiv,yybilder,yyloop,yyto,yycnt,yystep) { //v1.2
//copyright (c)1999 Yaromat, Jaro von Flocken
if ((document.layers)||(document.all)){
with (Math) {yynextx= eval(yyfnx)}
with (Math) {yynexty= eval(yyfny)}
yycnt=(yyloop && yycnt>=yystep*yybilder)?0:yycnt+yystep;
if (document.layers){
eval(yydiv+".top="+(yynexty+yytop))
eval(yydiv+".left="+(yynextx+yyleft))
}
if (document.all){
eval("yydiv=yydiv.replace(/.layers/gi, '.all')");
eval(yydiv+".style.pixelTop="+(yynexty+yytop));
eval(yydiv+".style.pixelLeft="+(yynextx+yyleft));
}
argStr='YY_Layerfx('+yyleft+','+yytop+',"'+yyfnx+'","'+yyfny+'","'+yydiv+'",'+yybilder+','+yyloop+','+yyto+','+yycnt+','+yystep+')';
if (yycnt<=yystep*yybilder){eval(yydiv+".yyto=setTimeout(argStr,yyto)");}
}
}
function YY_Mousetrace(evnt) { //v1.2 copyright (c)1999 Yaromat
if (yyns4)
{if (evnt.pageX) {yy_ml=evnt.pageX; yy_mt=evnt.pageY;} }
else{
yy_ml=(event.clientX + document.body.scrollLeft);
yy_mt=(event.clientY + document.body.scrollTop);
}
if (yy_tracescript)eval(yy_tracescript)
}
</script>
<script language="JavaScript">
function PopWin()
{
var PopWin = window.open("new.htm","PopWin","toolbar=no,directries=no,scrollBars=yes,height=350,width=400");
}
</script>
<div id="tooltip2"
style="position:absolute;visibility:hidden;clip:rect(0 150 50 0);width:150px;background-color:lightyellow">
<layer name="nstip" width="1000px" bgcolor="lightyellow"> </layer>
</div>
<div id="yyd0"
style="position:absolute; left:10px; top:50px; width:3px; height:3px; z-index:1; background-color: #19636c; layer-background-color: #19636c; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<div
id="yyd1"
style="position:absolute; left:20px; top:50px; width:3px; height:3px; z-index:1; background-color: #708574; layer-background-color: #708574; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<div
id="yyd2"
style="position:absolute; left:30px; top:50px; width:3px; height:3px; z-index:1; background-color: #379bbf; layer-background-color: #379bbf; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<div
id="yyd3"
style="position:absolute; left:40px; top:50px; width:3px; height:3px; z-index:1; background-color: #25184c; layer-background-color: #25184c; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<div
id="yyd4"
style="position:absolute; left:50px; top:50px; width:3px; height:3px; z-index:1; background-color: #31bd3c; layer-background-color: #31bd3c; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<div
id="yyd5"
style="position:absolute; left:60px; top:50px; width:3px; height:3px; z-index:1; background-color: #c11efd; layer-background-color: #c11efd; border: 1px none #000000; clip: rect(0 3 3 0)"></div>
<script>
var yyns4=window.Event?true:false; var yy_mt = 0; var yy_ml = 0;
document.onmousemove = YY_Mousetrace;
yy_tracescript = '';
if (yyns4){ document.captureEvents(Event.MOUSEMOVE);
YY_Mousetrace('',',document.YY_Mousetrace1')}
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/39.83007847812662))+0)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/34.224861639800686))+0)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd0\']',2000,true,80,0,1);
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/27.66510707209673))+30)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/9.240632767417667))+30)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd1\']',2000,true,80,0,1);
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/16.45318944579641))+60)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/16.0564452288292))+60)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd2\']',2000,true,80,0,1);
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/6.95348954836835))+90)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/44.13697049887155))+90)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd3\']',2000,true,80,0,1);
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/33.90077294583733))+120)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/2.2378828869411587))+120)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd4\']',2000,true,80,0,1);
YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/37.858312521039835))+150)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/18.083839795990098))+150)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd5\']',2000,true,80,0,1);
</script>
<script>
/*
Scrolling Image Map/Text Link Tooltip Script-
Special Thanks to: Rob(http://rob.yeah.net)
Miss Ann(http://annworld.126.com)
*/
六 cookie脚本
1 随登录次数变
2集成cookie
脚本说明:
第一步:把如下代码加入<body>区域中
<SCRIPT language="JavaScript"><!--
function getCookieVal (offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function SetCookie (name, value)
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function ResetCounts(name)
{
visits = 0;
SetCookie("visits", visits, expdate , "java2000.wol.com.html", null, false);
location.reload();
}
//-->
</SCRIPT><br><SCRIPT language="JavaScript"><!--
var expdate = new Date();
var visits;
// Set expiration date to a year from now.
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
if(!(visits = GetCookie("visits")))
visits = 0;
visits++;
SetCookie("visits", visits, expdate, "java2000.wol.com.html", null, false);
if(visits == 1)
document.write('<P><CENTER>Welcome Cadet '+username+'</CENTER>');
if(visits == 2)
document.write('<P><CENTER>Welcome Ensign '+username+'</CENTER>');
if(visits == 3)
document.write('<P><CENTER>Welcome Lieutenant '+username+'</CENTER>');
if(visits == 4)
document.write('<P><CENTER>Welcome Lieutenant-Commander '+username+'</CENTER>');
if(visits == 5)
document.write('<P><CENTER>Welcome Commander '+username+'</CENTER>');
if(visits == 6)
document.write('<P><CENTER>Welcome Vice-Admiral '+username+'</CENTER>');
if(visits == 7)
document.write('<P><CENTER>Welcome Admiral '+username+'</CENTER>');
if(visits==
document.write('<P><CENTER>Welcome Demi-God '+username+'</CENTER>');
if(visits== 9)
document.write('<P><CENTER>Welcome Demi-God '+username+'</CENTER>');
if(visits>=10)
document.write('<P><CENTER>Welcome Master '+username+'</CENTER>');
//-->
</SCRIPT><br>
<FONT FACE=ARIAL size="2">
<b>Your access was granted from
<SCRIP
发表评论
-
Unicode,ISO-8859-1,GBK,UTF-8编码及相互转换
2011-05-19 16:49 11121、函数介绍 在Java中 ... -
jabc绑定access数据库
2011-05-05 17:33 1008JDBC连接Access第一种方法: 你用下面的 ... -
关于JAR 文件包
2011-05-04 07:37 7181. JAR 文件包 JAR 文件 ... -
实训三:swing的初步实现及相应功能框架
2011-01-04 21:08 837import java.awt.*; import javax ... -
实训二:文件的读出与读入及功能的初步实现
2011-01-04 21:01 748import java.io.*; public class ... -
数组的使用及 键盘输入
2011-01-04 20:32 920import java.io.*; public c ...
相关推荐
JavaScript 动态网页设计期末大作业CHASMISH眼镜网(纯手打,高分项目)。 JavaScript 动态网页设计期末大作业CHASMISH眼镜网(纯手打,高分项目)。 JavaScript 动态网页设计期末大作业CHASMISH眼镜网(纯手打,...
CSS&javascript动态网页设计与制作CSS&javascript动态网页设计与制作CSS&javascript动态网页设计与制作CSS&javascript动态网页设计与制作CSS&javascript动态网页设计与制作CSS&javascript动态网页设计与制作CSS&...
本教程的源代码集合是基于《JavaScript动态网页设计经典实例教程》一书,旨在帮助读者深入理解和实践JavaScript编程技术。 1. JavaScript基础 - 变量与数据类型:JavaScript支持多种数据类型,包括基本类型(如...
在"JavaScript动态网页设计经典实例"中,你将深入学习如何利用JavaScript来增强网页的交互性和用户体验。以下是一些核心知识点的详细说明: 1. **基础语法**:JavaScript的基础包括变量、数据类型(如字符串、数字...
《JavaScript动态网页设计经典实例教程》的源代码包含了一系列用于教授JavaScript编程技术的实际示例,这些实例涵盖了从基础到高级的各个层面。JavaScript是一种广泛应用于Web开发的脚本语言,它使得网页具有交互性...
这个名为"JavaScript动态网页设计原代码"的资源集合,提供了深入学习JavaScript和实现网页动态效果的实例教程。 首先,JavaScript是客户端脚本语言,它在用户浏览器上运行,无需服务器支持即可改变网页内容、响应...
JavaScript 动态网页设计期末大作业(自己纯手打,98分期末作业)开发的97分高分设计项目,内含详细文档说明,可作为高分课程设计和期末大作业的参考,含有代码注释小白也可看的懂,有能力的小伙伴也可以在此基础上...
本教程“JavaScript动态网页设计经典实例教程”旨在通过一系列实用的示例,帮助学习者深入理解和掌握JavaScript在网页设计中的应用。 JavaScript的核心在于其灵活性和交互性,它允许网页对用户的操作做出实时响应,...
JavaScript 动态网页设计期末大作业(自己手写的,98分期末作业) 个人开发的97分高分设计项目,内含详细文档说明,可作为高分课程设计和期末大作业的参考,含有代码注释小白也可看的懂,有能力的小伙伴也可以在此...
在"JavaScript动态网页设计"这个主题中,我们将深入探讨JavaScript的核心概念、语法特性以及如何利用它来创建引人入胜的动态网页。 1. **JavaScript基础**:JavaScript是一种解释型、基于原型的对象导向语言,其...
JavaScript动态网页制作 了解和掌握JavaScript脚本语言funciton函数的用法,能在网页添加JavaScript脚本程序,实现网页的背景特效、掌握JavaScript脚本函数和对象的应用。
[CSS&javascript动态网页设计与制作].吴以欣.插图版
基本介绍】 JavaScript是一种基于对象和事件驱动并具有相对安全性的客户端脚本语言。同时也是一种广泛用于客户端Web开发的脚本语言,常用来给HTML网页添加动态功能,比如响应用户的各种操作。的浏览效果。
《JavaScript动态网页设计经典实例教程》是一本专为网页开发者设计的教程,旨在通过实例教学,帮助读者掌握JavaScript在创建动态网页中的应用。JavaScript是一种广泛使用的客户端脚本语言,它在网页设计中扮演着至关...
css javascript动态网页设计与制作基础图文课程,拥有多实例。
js大作业写的是一个关于疫情的大作业,一共有7个页面,功能有首页,我的二维码浮动、背景音乐自动播放、表格增删改查、用户登录、用户注册、图片录播、随机数产生,算是一个比较齐全的网页。内容比较简单,都是书本...
JavaScript 动态网页设计期末大作业(自己手写的,98分期末作业项目)开发的97分高分设计项目,内含详细文档说明,可作为高分课程设计和期末大作业的参考,含有代码注释小白也可看的懂,有能力的小伙伴也可以在此...
Javascript 动态网页课程设计期末大作业(仿漫步者网页项目)源码。 期末作业满分项目。Javascript 动态网页课程设计期末大作业(仿漫步者网页项目)源码。 期末作业满分项目。Javascript 动态网页课程设计期末大...