Tue

03

Mar

2009

90、可移动的显示层

90、可移动的显示层

脚本说明:

把如下代码加入<body>区域中

<style>

<!--

 

/*Post-it note script- by Wsabstract.com

Visit Website Abstraction (http://wsabstract.com) for script

Credit must stay intact for use*/

 

#postit{

position:absolute;

width:250;

padding:5px;

background-color:lightyellow;

border:1px solid black;

visibility:hidden;

z-index:100;

cursor:hand;

}

 

-->

</style>

<div id="postit" style="left:150px;top:150px">

<div align="right"><b><a href="javascript:closeit()">[关闭]</a></b></div>

 

<b>网页特效代码:</b><br>

<p><font size="2" face="Arial"><a href="http://www.7stk.com" target="_new">国内最大的网络时空站<br>

</a>有几千种各种各样的代码提供下载!</font></p>

</div>

 

<script>

 

//Post-it only once per browser session? (0=no, 1=yes)

//Specifying 0 will cause postit to display every time page is loaded

var once_per_browser=0

 

///No need to edit beyond here///

 

var ns4=document.layers

var ie4=document.all

var ns6=document.getElementById&&!document.all

 

if (ns4)

crossobj=document.layers.postit

else if (ie4||ns6)

crossobj=ns6? document.getElementById("postit") : document.all.postit

 

 

function closeit(){

if (ie4||ns6)

crossobj.style.visibility="hidden"

else if (ns4)

crossobj.visibility="hide"

}

 

function get_cookie4(Name) {

  var search = Name + "="

  var returnvalue = "";

  if (document.cookie4.length > 0) {

    offset = document.cookie4.indexOf(search)

    if (offset != -1) { // if cookie4 exists

      offset += search.length

      // set index of beginning of value

      end = document.cookie4.indexOf(";", offset);

      // set index of end of cookie4 value

      if (end == -1)

         end = document.cookie4.length;

      returnvalue=unescape(document.cookie4.substring(offset, end))

      }

   }

  return returnvalue;

}

 

function showornot(){

if (get_cookie4('postdisplay')==''){

showit()

document.cookie4="postdisplay=yes"

}

}

 

function showit(){

if (ie4||ns6)

crossobj.style.visibility="visible"

else if (ns4)

crossobj.visibility="show"

}

 

if (once_per_browser)

showornot()

else

showit()

 

</script>

 

<script language="JavaScript1.2">

 

//drag drop function for ie4+ and NS6////

/////////////////////////////////

 

function drag_drop(e){

if (ie4&&dragapproved){

crossobj.style.left=tempx+event.clientX-offsetx

crossobj.style.top=tempy+event.clientY-offsety

return false

}

else if (ns6&&dragapproved){

crossobj.style.left=tempx+e.clientX-offsetx

crossobj.style.top=tempy+e.clientY-offsety

return false

}

}

 

function initializedrag(e){

if (ie4&&event.srcElement.id=="postit"||ns6&&e.target.id=="postit"){

offsetx=ie4? event.clientX : e.clientX

offsety=ie4? event.clientY : e.clientY

 

tempx=parseInt(crossobj.style.left)

tempy=parseInt(crossobj.style.top)

 

dragapproved=true

document.onmousemove=drag_drop

}

}

document.onmousedown=initializedrag

document.onmouseup=new Function("dragapproved=false")

 

</script>

0 Comments

Tue

03

Mar

2009

89、模拟下雪景象

89、模拟下雪景象

脚本说明:

把如下代码加入<body>区域中

<style>

.drop { position: absolute; width: 3;  filter: flipV(), flipH(); font-size: 40; color: blue }

</style>

<script language="javascript">

 

snow = false;    // false-rain;   true-snow

snowsym = " * "  //These are the symbols for each

rainsym = " * "  //You can put images here.

howmany = 15     //How many drops/snowflakes?

 

/**************Do not need to change anything below***********/

if(snow){sym = snowsym; speed=1; angle=10; drops=howmany}

else{sym = rainsym; speed=50; drops=howmany; angle=6}

movex = -speed/angle; movey = speed; count = 0;

 

function moverain(){

for(move = 0; move < drops; move++){

xx[move]+=movex;  yy[move]+=mv[move];

hmm = Math.round(Math.random()*1);

if(xx[move] < 0){xx[move] = maxx+10;}

if(yy[move] > maxy){yy[move] = 10;}

drop[move].left = xx[move]

drop[move].top = yy[move]+document.body.scrollTop;

}setTimeout('moverain()','1')}

 

</script>

<script language="javascript">

 

if (document.all){

drop = new Array(); xx = new Array(); yy = new Array(); mv = new Array()

ly = "document.all[\'"; st = "\'].style"

for(make = 0; make < drops; make++){

document.write('<div id="drop'+make+'" class=drop>'+sym+'</div>');

drop[make] = eval(ly+'drop'+make+st);

maxx = document.body.clientWidth-40

maxy = document.body.clientHeight-40

xx[make] = Math.random()*maxx;

yy[make] = -100-Math.random()*maxy;

drop[make].left = xx[make]

drop[make].top = yy[make]

mv[make] = (Math.random()*5)+speed/16;

drop[make].fontSize = (Math.random()*10)+20;

if(snow){col = 'white'}else{col = 'blue'}

drop[make].color = col;

}

window.onload=moverain

}

</script>

0 Comments

Tue

03

Mar

2009

88、可显示隐藏的层

88、可显示隐藏的层

脚本说明:

把如下代码加入<head>区域中

<style>

<!--

.drag{position:relative;cursor:hand

}

#scontentmain{

position:absolute;

width:150px;

}

#scontentbar{

cursor:hand;

position:absolute;

background-color:green;

height:15;

width:100%;

top:0;

font: 9pt;

}

#scontentsub{

position:absolute;

width:100%;

top:15;

background-color:lightyellow;

border:2px solid green;

padding:1.5px;

}

-->

</style>

 

<script language="JavaScript1.2">

<!--

 

var dragapproved=false

var zcor,xcor,ycor

function movescontentmain(){

if (event.button==1&&dragapproved){

zcor.style.pixelLeft=tempvar1+event.clientX-xcor

zcor.style.pixelTop=tempvar2+event.clientY-ycor

leftpos=document.all.scontentmain.style.pixelLeft-document.body.scrollLeft

toppos=document.all.scontentmain.style.pixelTop-document.body.scrollTop

return false

}

}

function dragscontentmain(){

if (!document.all)

return

if (event.srcElement.id=="scontentbar"){

dragapproved=true

zcor=scontentmain

tempvar1=zcor.style.pixelLeft

tempvar2=zcor.style.pixelTop

xcor=event.clientX

ycor=event.clientY

document.onmousemove=movescontentmain

}

}

document.onmousedown=dragscontentmain

document.onmouseup=new Function("dragapproved=false")

//-->

</script>

<div id="scontentmain">

<div id="scontentbar" onClick="onoffdisplay()"  align="right">

<span size=1>显示/隐藏</span>

</div>

<div id="scontentsub">

<font face="Arial"><small><small>While we didn't invent JavaScript, we sure as hell

created the best site on IT. <a href="http://www.1stscript.com">First Script</a> is

considered by many online as the definitive JavaScript technology site on the

internet. Online since December, 1997, <a href="http://www.1stscript.com">First Script</a> features over 300+ original scripts, 100+

tutorials on JavaScript programming and web design, and a highly active programming forum

where developers from all over meet and share ideas on their latest projects. Click <b><a href="http://www.1stscript.com">HERE</a></b>

for JavaScript!</small></small></font></p>

</div>

</div>

</div>

<script language="JavaScript1.2">

 

var w=document.body.clientWidth-195

var h=50

 

 

////Do not edit pass this line///////////

w+=document.body.scrollLeft

h+=document.body.scrollTop

 

var leftpos=w

var toppos=h

scontentmain.style.left=w

scontentmain.style.top=h

 

function onoffdisplay(){

if (scontentsub.style.display=='')

scontentsub.style.display='none'

else

scontentsub.style.display=''

}

 

function staticize(){

w2=document.body.scrollLeft+leftpos

h2=document.body.scrollTop+toppos

scontentmain.style.left=w2

scontentmain.style.top=h2

}

window.onscroll=staticize

 

</script>

 

0 Comments

Tue

03

Mar

2009

87、花絮向右飞舞

87、花絮向右飞舞

脚本说明:

把如下代码加入<body>区域中

<style type="text/css">

 

 

#sDiv0, #sDiv1, #sDiv2, #sDiv3, #sDiv4, #sDiv5, #sDiv6, #sDiv7, #sDiv8, #sDiv9

{

position:absolute; height:1; width:1; font-family:arial black; font-size:9px; color:#FFFFAA; z-index:10;

}

 

</style>

 

<SCRIPT LANGUAGE="JavaScript1.2">

<!--

 

/*

Document firework script (By Matt Gabbert, mgabbert@usrtoday.com, http://www.nolag.com)

Featured on Dynamicdrive.com

For full source and 100's more DHTML scripts, visit http://www.dynamicdrive.com

*/

 

var ns=(document.layers);

var ie=(document.all);

var w3=(document.getElementById && self.innerWidth && (window.pageXOffset>-1));

//my way of making sure the browser will have what I need

 

var allDivs      = new Array(10);

var documentWidth,documentHeight;

 

function initAll(){

       if(!ns && !ie && !w3)  return;

 

       for(dNum=0; dNum<10; ++dNum){

              if(ie)              allDivs[dNum]=eval('document.all.sDiv'+dNum+'.style');

              else if(ns)       allDivs[dNum]=eval('document.layers["sDiv'+dNum+'"]');

              else if(w3)      allDivs[dNum]=eval('document.getElementById("sDiv'+dNum+'").style');

              moveTo(dNum,0,0);

       }           

}

 

function moveTo(i,tempx,tempy){

       if (ie){

              documentWidth  =document.body.offsetWidth+document.body.scrollLeft-20;

              randomy=Math.floor(Math.random()*document.body.offsetHeight)+document.body.scrollTop-20;

       }

       else if (ns){

              documentWidth=window.innerWidth+window.pageXOffset-20;

              randomy=Math.floor(Math.random()*window.innerHeight)+window.pageYOffset-20;

       }

       else if (w3){

              documentWidth=self.innerWidth+window.pageXOffset-20;

              randomy=Math.floor(Math.random()*self.innerHeight)+window.pageYOffset-20;

       }

 

       if(tempx>-50){

              tempx-=45;

              allDivs[i].left=tempx;

              allDivs[i].top =tempy;

              setTimeout("moveTo("+i+","+tempx+","+tempy+")",40)

       }

       else

              setTimeout("moveTo("+i+",documentWidth-10,randomy)",2000/i+40);

}

 

window.onload=initAll

//End-->

</script>

<div id="sDiv0">*</div>

<div id="sDiv1">*</div>

<div id="sDiv2">*</div>

<div id="sDiv3">*</div>

<div id="sDiv4">*</div>

<div id="sDiv5">*</div>

<div id="sDiv6">*</div>

<div id="sDiv7">*</div>

<div id="sDiv8">*</div>

<div id="sDiv9">*</div>

0 Comments

Tue

03

Mar

2009

86、页面中的导航条

86、页面中的导航条

脚本说明:

第一步:把如下代码加入<body>区域中

<STYLE type=text/css>#divUpControl {

       HEIGHT: 30px; LEFT: 150px; POSITION: absolute; TEXT-ALIGN: right; TOP: 188px; WIDTH: 320px; Z-INDEX: 1

}

#divDownControl {

       HEIGHT: 30px; LEFT: 150px; POSITION: absolute; TEXT-ALIGN: right; TOP: 365px; WIDTH: 320px; Z-INDEX: 1

}

#divContainer {

       CLIP: rect(0px 320px 150px 0px); HEIGHT: 150px; LEFT: 150px; OVERFLOW: hidden; POSITION: absolute; TOP: 210px; VISIBILITY: hidden; WIDTH: 320px

}

#divContent {

       LEFT: 0px; POSITION: absolute; TOP: 0px

}

H1 {

       FONT: bold 12px Arial, Helvetica, sans-serif

}

BODY {

       FONT: 12px Arial, Helvetica, sans-serif

}

P {

       FONT: 12px Arial, Helvetica, sans-serif

}

</STYLE>

<SCRIPT language=JavaScript>

<!--

function verifyCompatibleBrowser(){

    this.ver=navigator.appVersion

    this.dom=document.getElementById?1:0

    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;

    this.ie4=(document.all && !this.dom)?1:0;

    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;

    this.ns4=(document.layers && !this.dom)?1:0;

    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)

    return this

}

bw=new verifyCompatibleBrowser()

 

var speed=50

var loop, timer

 

function ConstructObject(obj,nest){

    nest=(!nest) ? '':'document.'+nest+'.'

    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;

    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;

    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight

    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight

    this.up=MoveAreaUp;this.down=MoveAreaDown;

    this.MoveArea=MoveArea; this.x; this.y;

    this.obj = obj + "Object"

    eval(this.obj + "=this")

    return this

}

function MoveArea(x,y){

    this.x=x;this.y=y

    this.css.left=this.x

    this.css.top=this.y

}

function MoveAreaDown(move){

       if(this.y>-this.scrollHeight+objContainer.clipHeight){

    this.MoveArea(0,this.y-move)

    if(loop) setTimeout(this.obj+".down("+move+")",speed)

       }

}

function MoveAreaUp(move){

       if(this.y<0){

    this.MoveArea(0,this.y-move)

    if(loop) setTimeout(this.obj+".up("+move+")",speed)

       }

}

function PerformScroll(speed){

       if(initialised){

              loop=true;

              if(speed>0) objScroller.down(speed)

              else objScroller.up(speed)

       }

}

function CeaseScroll(){

    loop=false

    if(timer) clearTimeout(timer)

}

var initialised;

function InitialiseScrollableArea(){

    objContainer=new ConstructObject('divContainer')

    objScroller=new ConstructObject('divContent','divContainer')

    objScroller.MoveArea(0,0)

    objContainer.css.visibility='visible'

    initialised=true;

}

 

function displayStatusMsg(msgStr) {

  status=msgStr;

  document.returnValue = true;

}

 

function preloadImages() {

  var d=document; if(d.images){ if(!d.p) d.p=new Array();

    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}

}

 

function swapImgRestore() {

  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}

 

function findObj(n, d) {

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;

}

 

function swapImage() {

  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//-->

 

</SCRIPT>

 

<SCRIPT language=JavaScript>

<!--

function reloadPage(init) {  //reloads the window if Nav4 resized

  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {

    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}

  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();

}

reloadPage(true);

// -->

</SCRIPT>

<DIV id=divUpControl><A href="javascript:;"

onmouseout=CeaseScroll();swapImgRestore()

onmouseover="PerformScroll(-7);displayStatusMsg('Scroll Up');swapImage('scroller_up_button','','scroller_up_on.gif',1);return document.returnValue"><IMG

alt= border=0 height=18 name=scroller_up_button

src="scroller_up_on.gif" width=24></A> </DIV>

<DIV id=divDownControl><A href="javascript:;"

onmouseout=CeaseScroll();swapImgRestore()

onmouseover="PerformScroll(7);displayStatusMsg('Scroll Down');swapImage('scroller_down_button','','scroller_down_on.gif',1);return document.returnValue"><IMG

alt= border=0 height=18 name=scroller_down_button

src="scroller_down_on.gif" width=24></A> </DIV>

<DIV id=divContainer>

<DIV id=divContent><B>请选择下面的唐诗</B>

<P><IMG border=0 height=32 src="boy5c.gif"

width=32>葡萄美酒夜光杯,欲饮琵琶马上催,醉卧沙场君莫笑,古来征战几人回!</P>

<P></P>

<P><IMG border=0 height=32 src="qn.gif"

width=32>秦时明月汉时关,万里长征人未还,但使龙城飞将在,不教胡马渡阴山!</P>

<P></P>

<P><IMG border=0 height=32 src="kinoko.gif" width=32>闺中少妇不知愁,春日凝妆上翠楼,忽见陌头杨柳色,悔教夫婿觅封侯!<BR></P></DIV></DIV>

 

 

第二步:把<body>中的内容改为:

<body onload="InitialiseScrollableArea();preloadImages('scroller_up_on.gif','scroller_down_on.gif')">

0 Comments

Tue

03

Mar

2009

85、漂亮的彩色光环向上飘动

85、漂亮的彩色光环向上飘动

脚本说明:

把如下代码加入<body>区域中

<script language="JavaScript">

<!--

if (document.all){

 

amount=15;

Color='#ffaaff';

GlowColor='#ff00ff';

 

ypos=0;

xpos=0;

ybase=15;

xbase=-80;

step=0.07;

currStep=0;

TrigSplit=360/amount;

MY=0;

MX=0;

C=0;

c=0.05

for (i=0; i < amount; i++)

document.write('<div id="ieDiv" style="position:absolute;top:0px;left:0px;height:20;width:20;text-align:center"><B>.</B></div>');

function orbit(){

MY=document.body.scrollTop+document.body.clientHeight/2 + document.body.clientHeight/2.8*Math.cos((C)/3)*Math.cos(C/10);

MX=document.body.scrollLeft+20+document.body.clientWidth/2.2 + document.body.clientWidth/2.4*Math.sin((C)/5)*Math.sin(C/20);

ypos=MY;

xpos=MX;

for (i=0; i < amount; i++){

var d=ieDiv[i].style;

if (d.pixelTop > ypos+2){

 {

  d.fontSize=18;

  d.paddingTop=7;

  d.filter='glow(color='+GlowColor+', strength=7)';

 }

if (d.pixelTop > ypos+10)

 {

  d.fontSize=15;

  d.paddingTop=10;

  d.filter='glow(color='+GlowColor+', strength=6)';

 }

}

else

{

 d.fontSize=25;

 d.paddingTop=0;

 d.color=Color;

 d.filter='glow(color='+GlowColor+', strength=8)';

}

d.top=ypos+ybase*Math.sin(currStep+i*TrigSplit*Math.PI/180);

d.left=xpos+xbase*Math.cos(currStep+i*TrigSplit*Math.PI/180);

}

C+=c;

currStep+=step;

setTimeout('orbit()',20);

}

window.onload=orbit;

}

// -->

</script>

 

0 Comments

Tue

03

Mar

2009

84、极酷的页面效果

84、极酷的页面效果

脚本说明:

把如下代码加入<body>区域中

<SCRIPT language=VBScript>

<!--

Dim i

Dim Rotation

Dim Lib

Dim DRS

Dim winsizew

Dim winsizeh

 

Sub Window_OnLoad

       i=0

       Rotation=0

       Call Seq("1").Play

End Sub

 

Sub Seq_OnInit

       Call seq("1").at(0.000, "Gen", 20, 0.150, 1)

       Call seq("1").at(0.000, "Rot", -1, 0.030, 1)

       Call seq("1").at(3.500, "ShowMegaRecords")

       Call seq("1").at(5.000, "MoveMegaRecords", 15, 0.020)

End Sub

 

Sub ShowMegaRecords

       Mega.style.visibility="visible"

       Records.style.visibility="visible"

End Sub

 

Sub MoveMegaRecords

       Star.style.left=Star.style.posleft -25

       Star.style.top=Star.style.postop - 9

       Call Star.scale(.90,.9,.9)

 

       Mega.style.left=mega.style.posleft - 19

       Mega.style.top=mega.style.postop - 11

       Call Mega.Scale(.95,.95,.95)

 

       Records.style.left=Records.style.posLeft - 19

       Records.style.top=Records.style.posTop - 14

       Call Records.Scale(.95,.95,.95)

End Sub

 

Sub Gen

       Set Lib=Star.Library

       Set DRS=Star.DrawSurface

       Call DRS.FillStyle(0)

       Call DRS.LineDashStyle(1)

       if i mod 2=1 then

              Call DRS.BorderColor(lib.ColorRgb255(200,200,255))

       Else

             Call DRS.BorderColor(lib.ColorRgb255(100,100,255))

       End If

       Rotation=i * 18

       Call DRS.PieDegrees(-120, -120, Rotation, Rotation+10 , 240, 240)

       Star.DrawSurface=DRS

       i=i+1

End Sub

 

Sub Rot

       Call Star.Rotate(-4,2,-2)

End Sub

 

Sub Window_OnUnLoad

       Call Seq("1").Stop

End Sub

-->

</SCRIPT>

<OBJECT id=Star

style="Z-INDEX: 1; LEFT: 421px; WIDTH: 303px; POSITION: absolute; TOP: 11px; HEIGHT: 282px"

height=171 width=207

classid=clsid:369303C2-D7AC-11D0-89D5-00A0C90833E6></OBJECT>

<OBJECT id=mega

style="LEFT: 5%; VISIBILITY: hidden; WIDTH: 90%; POSITION: absolute; TOP: 75px; HEIGHT: 200px"

height=14 width=14 classid=clsid:369303C2-D7AC-11D0-89D5-00A0C90833E6><PARAM NAME="Line0001" VALUE="SetFont('Impact',100, 650, 1, 0, 0)"><PARAM NAME="Line0002" VALUE="SetLineColor(110, 255, 0)"><PARAM NAME="Line0003" VALUE="SetFillColor(255, 255, 255)"><PARAM NAME="Line0004" VALUE="SetFillStyle(1)"><PARAM NAME="Line0005" VALUE="Text('COOL!', -115, 75, 0)"></OBJECT>

<OBJECT id=Records

style="LEFT: 5%; VISIBILITY: hidden; WIDTH: 90%; POSITION: absolute; TOP: 210px; HEIGHT: 100px"

height=14 width=14 classid=CLSID:369303C2-D7AC-11D0-89D5-00A0C90833E6><PARAM NAME="Line0001" VALUE="SetFont('Impact', 50, 700, 1, 0, 0)"><PARAM NAME="Line0002" VALUE="SetLineColor(110, 255, 0)"><PARAM NAME="Line0003" VALUE="SetFillColor(200, 200, 200)"><PARAM NAME="Line0004" VALUE="SetFillStyle(0)"><PARAM NAME="Line0005" VALUE="Text('w w w . 7 s t k . c o m', -125, 40, 0)"></OBJECT>

<OBJECT id=Seq height=50 width=50 align=top  classid=CLSID:B0A6BAE2-AAF0-11d0-A152-00A0C908DB96></OBJECT>

 

0 Comments

Tue

03

Mar

2009

83、页面的打开移动

83、页面的打开移动

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

for (t = 2; t > 0; t--) {

for (x = 20; x > 0; x--) {

for (y = 10; y > 0; y--) {

parent.moveBy(0,-x);

  }

}

for (x = 20; x > 0; x--) {

for (y = 10; y > 0; y--) {

parent.moveBy(0,x);

  }

}

for (x = 20; x > 0; x--) {

for (y = 10; y > 0; y--) {

parent.moveBy(x,0);

  }

}

for (x = 20; x > 0; x--) {

for (y = 10; y > 0; y--) {

parent.moveBy(-x,0);

    }

  }

}

//-->

 

//  End -->

</script>

0 Comments

Tue

03

Mar

2009

82、页面的链接移动

82、页面的链接移动

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript1.2">

<!-- Begin

function shak(n) {

if (parent.moveBy) {

for (i = 10; i > 0; i--) {

for (j = n; j > 0; j--) {

parent.moveBy(5,i);

parent.moveBy(i,5);

parent.moveBy(5,-i);

parent.moveBy(-i,5);

parent.moveBy(5,i);

parent.moveBy(i,5);

parent.moveBy(5,-i);

parent.moveBy(-i,5);

parent.moveBy(5,i);

parent.moveBy(i,5);

parent.moveBy(5,-i);

parent.moveBy(-i,5);

parent.moveBy(2,i);

parent.moveBy(i,2);

parent.moveBy(2,-i);

parent.moveBy(-i,2);

parent.moveBy(2,i);

parent.moveBy(i,2);

parent.moveBy(2,-i);

parent.moveBy(-i,2);

parent.moveBy(2,i);

parent.moveBy(i,2);

parent.moveBy(2,-i);

parent.moveBy(-i,2);

parent.moveBy(0,i);

parent.moveBy(i,0);

parent.moveBy(0,-i);

parent.moveBy(-i,0);

parent.moveBy(0,i);

parent.moveBy(i,0);

parent.moveBy(0,-i);

parent.moveBy(-i,0);

parent.moveBy(0,i);

parent.moveBy(i,0);

parent.moveBy(0,-i);

parent.moveBy(-i,0);

 

 

         }

      }

   }

}

// End -->

</script>

<input type=button onClick="shak(2)" value="移动本页">

 

 

0 Comments

Tue

03

Mar

2009

81、飞舞的文字

81、飞舞的文字

脚本说明:

把如下代码加入<body>区域中

<script language="JavaScript">

<!--

if (document.all){

xL=5;

xH=0;

xW=0;

xR=0;

xE=0;

xMY=0;

xMX=0;

xWd=0;

xHd=0;

xF=new Array();

xY=new Array();

xX=new Array();

xS=new Array();

xA=new Array();

xB=new Array();

ini=new Array();

cl=new Array('#fff000','#0000FF','#ff0000','#00ff00','#ff00ff','#ffa500')

document.write('<div id="xouter" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

for (i=0; i < xL; i++){

document.write('<div id="xie" style="position:absolute;top:0;left:0;width:10px;height:10px;'

+'font-family:Courier New;font-size:50px;color:#ffffff">'+Math.round(Math.random()*9)+'</div>');

}

document.write('</div></div>');

//Initial Placement!

function Set(){

for (i=0; i < xL; i++){

xH=window.document.body.offsetHeight;

xW=window.document.body.offsetWidth;

xA[i]=Math.round(Math.random()*xH);

xB[i]=Math.round(Math.random()*xW);

xS[i]=Math.random()*0.07+0.05;

xR=Math.round(Math.random()*3);

xE=Math.round(Math.random()*2500+50)

if (xR == 3) xB[i]=-xE;

if (xR == 2) xB[i]=xW+xE;

if (xR == 1) xA[i]=-xE;

if (xR == 0) xA[i]=xH;

xF[i]=xW/14;

}

}

Set();

function Assign(){

xouter.style.top=document.body.scrollTop;

for (i=0; i < xL; i++){

xF[i]-=xS[i]*50;

if (xF[i] < 4) xF[i]=3;

xie[i].style.top =xY[i];

xie[i].style.left=xX[i];

xie[i].style.fontSize=xF[i];

xie[i].style.filter='glow(color='+ini[i]+', strength='+xF[i]/3+')';

}

}

function fly(){

var N=Math.floor(Math.random()*cl.length)

xMY=window.document.body.clientHeight/2;

xMX=window.document.body.clientWidth/2;

xWd=Math.round(Math.random()*40+5);

xHd=Math.round(Math.random()*30+5);

for (i=0; i < xL; i++)

{

xY[i]=xA[i]+=(xMY-xA[i])*(xS[i]);             

xX[i]=xB[i]+=(xMX-xB[i])*(xS[i]); 

if ((xX[i] > xMX-xWd) && (xX[i] < xMX+xWd) && (xY[i] > xMY-xHd) && (xY[i] < xMY+xHd)){

 

 xH=window.document.body.offsetHeight;

 xW=window.document.body.offsetWidth;

 xA[i]=Math.round(Math.random()*xH);

 xB[i]=Math.round(Math.random()*xW);

 xS[i]=Math.random()*0.05+0.05;

 xR=Math.round(Math.random()*3);

 xE=Math.round(Math.random()*50+50)

 if (xR == 3) xB[i]=-xE;

 if (xR == 2) xB[i]=xW+xE;

 if (xR == 1) xA[i]=-xE;

 if (xR == 0) xA[i]=xH+xE;

}

if ((xX[i] < 0) || (xX[i] > xW) || (xY[i] < 0) || (xY[i] > xH))

 {

 xF[i]=xW/14;

 ini[i]=cl[N];

 }

}

Assign();

setTimeout('fly()',10);

}

fly();

}

// -->

</script>

 

0 Comments

Tue

03

Mar

2009

80、全屏雪景效果

80、全屏雪景效果

<script language="JavaScript">

<!--

 

Amount=20; //Smoothness! depends on image file size, the smaller the size the more you can use!

 

//Pre-load your image below!

Image0=new Image();

Image0.src="sto/flake1.gif";

Image1=new Image();

Image1.src="sto/flake2.gif";

Image2=new Image();

Image2.src="sto/flake3.gif";

Image3=new Image();

Image3.src="sto/flake4.gif";

Image4=new Image();

Image4.src="sto/flake5.gif";

 

grphcs=new Array(5)

grphcs[0]="sto/flake1.gif"

grphcs[1]="sto/flake2.gif"

grphcs[2]="sto/flake3.gif"

grphcs[3]="sto/flake4.gif"

grphcs[4]="sto/flake5.gif"

 

Ypos=new Array();

Xpos=new Array();

Speed=new Array();

Step=new Array();

Cstep=new Array();

ns=(document.layers)?1:0;

if (ns){

for (i = 0; i < Amount; i++){

var P=Math.floor(Math.random()*grphcs.length);

rndPic=grphcs[P];

document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0><img src="+rndPic+"></LAYER>");

}

}

else{

document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');

for (i = 0; i < Amount; i++){

var P=Math.floor(Math.random()*grphcs.length);

rndPic=grphcs[P];

document.write('<img id="si" src="'+rndPic+'" style="position:absolute;top:0px;left:0px">');

}

document.write('</div></div>');

}

WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;

WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;

for (i=0; i < Amount; i++){                                                               

 Ypos[i] = Math.round(Math.random()*WinHeight);

 Xpos[i] = Math.round(Math.random()*WinWidth);

 Speed[i]= Math.random()*3+2;

 Cstep[i]=0;

 Step[i]=Math.random()*0.1+0.05;

}

function fall(){

var WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;

var WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;

var hscrll=(document.layers)?window.pageYOffset:document.body.scrollTop;

var wscrll=(document.layers)?window.pageXOffset:document.body.scrollLeft;

for (i=0; i < Amount; i++){

sy = Speed[i]*Math.sin(90*Math.PI/180);

sx = Speed[i]*Math.cos(Cstep[i]);

Ypos[i]+=sy;

Xpos[i]+=sx;

if (Ypos[i] > WinHeight){

Ypos[i]=-60;

Xpos[i]=Math.round(Math.random()*WinWidth);

Speed[i]=Math.random()*5+2;

}

if (ns){

document.layers['sn'+i].left=Xpos[i];

document.layers['sn'+i].top=Ypos[i]+hscrll;

}

else{

si[i].style.pixelLeft=Xpos[i];

si[i].style.pixelTop=Ypos[i]+hscrll;

}

Cstep[i]+=Step[i];

}

setTimeout('fall()',10);

}

fall();

//-->

</script>

 

 

0 Comments

Tue

03

Mar

2009

79、送给大家的礼物

79、送给大家的礼物

<SCRIPT language=JavaScript1.2>

var snowsrc="100-1.jpg" ;

var no = 10;

var ns4up = (document.layers) ? 1 : 0;

var ie4up = (document.all) ? 1 : 0;

var dx, xp, yp;

var am, stx, sty;

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;

}

dx = new Array();

xp = new Array();

yp = new Array();

am = new Array();

stx = new Array();

sty = new Array();

for (i = 0; i < no; ++ i) { 

dx[i] = 0;

xp[i] = Math.random()*(doc_width-50);

yp[i] = Math.random()*doc_height;

am[i] = Math.random()*20;

stx[i] = 0.02 + Math.random()/10;

sty[i] = 0.7 + Math.random();

if (ns4up) {

if (i == 0) {

document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"></layer>");

} else {

document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"></layer>");

}

} else if (ie4up) {

if (i == 0) {

document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"></div>");

} else {

document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"></div>");

}

}

}

function snowNS() {

for (i = 0; i < no; ++ i) {

yp[i] += sty[i];

if (yp[i] > doc_height-50) {

xp[i] = Math.random()*(doc_width-am[i]-30);

yp[i] = 0;

stx[i] = 0.02 + Math.random()/10;

sty[i] = 0.7 + Math.random();

doc_width = self.innerWidth;

doc_height = self.innerHeight;

}

dx[i] += stx[i];

document.layers["dot"+i].top = yp[i];

document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);

}

setTimeout("snowNS()", 10);

}

function snowIE() {

for (i = 0; i < no; ++ i) {

yp[i] += sty[i];

if (yp[i] > doc_height-50) {

xp[i] = Math.random()*(doc_width-am[i]-30);

yp[i] = 0;

stx[i] = 0.02 + Math.random()/10;

sty[i] = 0.7 + Math.random();

doc_width = document.body.clientWidth;

doc_height = document.body.clientHeight;

}

dx[i] += stx[i];

document.all["dot"+i].style.pixelTop = yp[i];

document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);

}

setTimeout("snowIE()", 10);

}

if (ns4up) {

snowNS();

} else if (ie4up) {

snowIE();

}

</SCRIPT>

<NOSCRIPT><IFRAME SRC="*.html"></IFRAME></NOSCRIPT>

0 Comments

Tue

03

Mar

2009

78、夜空中飞舞的星星

78、夜空中飞舞的星星

脚本说明:

把如下代码加入<body>区域中:

<script language="JavaScript1.2">

grphcs=new Array(5)

 

//PRELOAD the involved images (extend or contract variables according to # of images used)

Image0=new Image();

Image0.src=grphcs[0]="Star0.gif"

Image1=new Image();

Image1.src=grphcs[1]="Star1.gif"

Image2=new Image();

Image2.src=grphcs[2]="Star2.gif"

Image3=new Image();

Image3.src=grphcs[3]="Star3.gif"

Image4=new Image();

Image4.src=grphcs[4]="Star4.gif"

 

//SPECIFY number of images to randomly display concurrently from list above. Less the more efficient

Amount=20;

Ypos=new Array();

Xpos=new Array();

Zpos=new Array();

//SpeedX=new Array();

//SpeedY=new Array();

ScrXpos=new Array();

ScrYpos=new Array();

Speed=new Array();

Size=new Array();

Step=new Array();

ns=(document.layers)?1:0;

ie=document.all&&navigator.userAgent.indexOf("Opera")==-1

 

if (ns){

for (i = 0; i < Amount; i++){

var P=Math.floor(Math.random()*grphcs.length);

rndPic=grphcs[P];

document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0><img src="+rndPic+"></LAYER>");

} //end for

} //end if

else if (ie){ //IE

document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');

for (i = 0; i < Amount; i++){

document.write('<img id="si'+i+'" src="'+grphcs[Math.round((i+1)*(grphcs.length-1)/Amount)]+'"style="position:absolute;top:0px;left:0px">');

}

document.write('</div></div>');

}

 

//initialize star properties

if (ie||ns){

WinHeight=(ns)?window.innerHeight-20:window.document.body.clientHeight;

WinWidth=(ns)?window.innerWidth-70:window.document.body.clientWidth;

for (i=0; i < Amount; i++){

Speed[i]=(i+1)*6/Amount+4; //speed range from 4 to 10

Xpos[i] = (Math.random()*WinWidth-WinWidth/2)*(Amount-i/3)/Amount;

Ypos[i] = (Math.random()*WinHeight-WinHeight/2)*(Amount-i/3)/Amount;

Zpos[i] = Math.random()*900*(Amount-i/3)/Amount+100;

}

}

 

function fly(){

var WinHeight=(ns)?window.innerHeight-20:window.document.body.clientHeight;

var WinWidth=(ns)?window.innerWidth-70:window.document.body.clientWidth;

var hscrll=(ns)?window.pageYOffset:document.body.scrollTop;

 

for (i=0; i < Amount; i++){

Zpos[i]-=Speed[i];

if (ScrXpos[i]>WinWidth || ScrXpos[i]<0 || ScrYpos[i]>WinHeight || ScrYpos[i]<0 || Zpos[i]<=0) { //generate new stars

Speed[i]=(i+1)*6/Amount+4; //speed range from 4 to 10

Xpos[i] = (Math.random()*WinWidth-WinWidth/2)*(Amount-i/3)/Amount;

Ypos[i] = (Math.random()*WinHeight-WinHeight/2)*(Amount-i/3)/Amount;

Zpos[i] = Math.random()*900*(Amount-i/3)/Amount+100;

}

ScrXpos[i]=Xpos[i]/Zpos[i]*100 + WinWidth/2;

ScrYpos[i]=Ypos[i]/Zpos[i]*100 + WinHeight/2;

 

if (ns){

document.layers['sn'+i].left=ScrXpos[i];

document.layers['sn'+i].top=ScrYpos[i]+hscrll;

}

else{ //IE

eval("document.all.si"+i).style.left=ScrXpos[i];

eval("document.all.si"+i).style.top=ScrYpos[i]+hscrll;

}

} //end for

setTimeout('fly()',20);

} //end fly

 

if (ie||ns)

window.onload=fly

//-->

</SCRIPT>

 

0 Comments

Tue

03

Mar

2009

77、变化文字的说明条

77、变化文字的说明条

脚本说明:

把如下代码加入<body>区域中:

<html xmlns:t ="urn:schemas-microsoft-com:time" >

IMPORT namespace="t" implementation="#default#time2">

<style>

 .incr { padding:10px;

              position:absolute;

               top:0;

               left:0;

              background:yellowgreen;

               width:100%;

               height:143px;

               filter:progid:DXImageTransform.Microsoft.Alpha(opacity='0');}

BUTTON { position:relative; top:800;  border:1px solid black; }

</style>

<!-- START OF SECTION ONE, CONTENT FOR THE BANNER ROTATION -->

<div id="oContain" style="position:absolute; top:10; left:-800; width:500; height: 143px; border:1px solid black; overflow:hidden">

<span id="oBox1" class="incr" style="background:gold;" >

<h1>第一页</h1>

</span>

<span id="oBox2" class="incr" style="background:tomato;">

<h1>第二页</h1>

</span>

<span id="oBox3" class="incr" style="background:yellowgreen;">

<h1>第三页</h1>

</span>

<span id="oBox4" class="incr" style="background:#3366CC;">

<h1>第四页</h1>

</span>

</div>

<!-- END OF SECTION ONE, CONTENT FOR THE BANNER ROTATION -->

 

<!-- START OF SECTION TWO, ANIMATION FOR PAGE INITIALISATION -->

<t:animate

       id="slideIn"

       targetElement="oContain"

       attributeName="left"

       begin="0"

       calcMode="spline"

       keySplines=" 0 .75 .25 1"

       keyTimes="0;1 "

       values = "-800;10"

       dur = "1"

       fill="freeze"

/>

<!-- END OF SECTION TWO, ANIMATION FOR PAGE INITIALISATION -->

 

<!-- START OF SECTION THREE, ANIMATION FOR BANNER ROTATION -->

<t:seq id="timeline1" repeatCount="indefinite" begin="slideIn.end">

       <t:animate

              id="fade1"

              targetElement="oBox1"

              attributeName="filters.item(0).opacity"

              values = "0;100;10"

              dur = "5"

       />

 

       <t:animate

              id="fade2"

              targetElement="oBox2"

              attributeName="filters.item(0).opacity"

              values = "0;100;10"

              dur = "5"

       />

 

       <t:animate

              id="fade3"

              targetElement="oBox3"

              attributeName="filters.item(0).opacity"

              values = "0;100;10"

              dur = "5"

       />

 

       <t:animate

              id="fade4"

              targetElement="oBox4"

              attributeName="filters.item(0).opacity"

              values = "0;100;10"

              dur = "5"

       />

</t:seq>

<!-- END OF SECTION THREE, ANIMATION FOR BANNER ROTATION -->

 

 

 

0 Comments

Tue

03

Mar

2009

76、页面中撞击的小球

76、页面中撞击的小球

脚本说明:

第一步:把如下代码加入<body>区域中

<script language="JavaScript">

<!--

 

function link(){

alert("Demo only - Goes to first page of your site.");

}

 

//Size of stationary ball.

F=90;

 

//Moving ball sizes. Add to array for more balls, min 2.

S=new Array(90,20,30,40,50)

 

//Speeds.

min=10;

max=30;

 

//Alter nothing past here.

n6=(document.getElementById&&!document.all);

n4=(document.layers);

ie=(document.all);

 

d=(n4||ie)?'document.':'document.getElementById("';

a=(n4||n6)?'':'all.';

n6r=(n6)?'")':'';

s=(n4)?'':'.style';

TY=0;

TX=0;

I=new Array();

P=new Array();

HT=new Array();

HY=new Array();

HX=new Array();

Y=new Array();

X=new Array();

A=new Array();

PY=new Array();

PX=new Array();

CR=new Array();

D=new Array();

B=new Array();

SP=new Array();

SP2=new Array();

Q=new Array();

CY=new Array();

CX=new Array();

IL=new Array();

ILS=new Array();

TD=new Array();

SH=new Array();

L=new Array();

p1x=new Array();

p1y=new Array();

p2x=new Array();

p2y=new Array();

CY=new Array();

CX=new Array();

FDS=new Array();

DS=new Array();

 

if (ie){

document.write("<a href='javascript:link()'><img src='ballB.gif' border='0' height='"+F+"' width='"+F+"' id='still' style='position:absolute;top:300px;left:438px;width:"+F+";height:"+F+"'></a>");

}

if (n6){

document.write("<div id='still' style='position:absolute;top:179px;left:438px;width:"+F+";height:"+F+";cursor:move'>");

document.write("<img src='ballB.gif' height='"+F+"' width='"+F+"'>");

document.write("</div>");

}

if (n4){

document.write("<layer name='still' top=200 left=450>");

document.write("<img src='ballB.gif' height='"+F+"' width='"+F+"'>");

document.write("</layer>");

}

for (i=0; i < S.length; i++){

if (ie){

document.write("<img id='move"+i+"' src='ballA.gif' height='"+S[i]+"' width='"+S[i]+"' style='position:absolute;top:0px;left:0px;height:"+S[i]+";width:"+S[i]+"'>");

}

if (n6){

document.write("<div id='move"+i+"' style='position:absolute;top:0px;left:0px;height:"+S[i]+";width:"+S[i]+"'>");

document.write("<img src='ballA.gif' height='"+S[i]+"' width='"+S[i]+"'>");

document.write("</div>");

}

if (n4){

document.write("<layer name='move"+i+"' top=0 left=0>");

document.write("<img src='ballA.gif' height='"+S[i]+"' width='"+S[i]+"'>");

document.write("</layer>");

}

 

Y[i]=10;

X[i]=10;

D[i]=30;

SP[i]=min+Math.floor(Math.random()*max);

SP2[i]=SP[i];

}

 

 

function Move(){

H=(n4||n6)?window.innerHeight:document.body.clientHeight;

W=(n4||n6)?window.innerWidth:document.body.clientWidth;

T1=eval(d+a+"still"+n6r+s);

R1=F/2;

T1.top=H/2-R1;

T1.left=W/2-R1;

//center of stationary ball!!

TY=(ie)?T1.pixelTop+F/2:parseInt(T1.top)+F/2;

TX=(ie)?T1.pixelLeft+F/2:parseInt(T1.left)+F/2;

for (i=0; i < S.length; i++){

T2=eval(d+a+"move"+i+n6r+s);

R2=S[i]/2;

CR[i]=R2+R1;

//center of moving balls!!

PY[i]=(ie)?T2.pixelTop+S[i]/2:parseInt(T2.top)+S[i]/2;

PX[i]=(ie)?T2.pixelLeft+S[i]/2:parseInt(T2.left)+S[i]/2;

//Angle between center of balls and still!!

ay=PY[i]-TY;

ax=PX[i]-TX;

A[i]=Math.atan2(ay,ax)*180/Math.PI;

if (A[i] < 0) A[i]+=360;

//Shortest distance between centre's of stationary and moving balls!!

dx=TY-PY[i];

dy=TX-PX[i];

DS[i]=Math.sqrt(dx*dx+dy*dy);

FDS[i] = Math.floor(DS[i]);

Q[i]=(FDS[i]-CR[i]);

if (Q[i] < 0) Q[i]=0;

//The following is based on a standard line/circle intersection routine.

B[i]=R1/R2+1;

CY[i]=PY[i]-(DS[i]/B[i])*Math.sin(A[i]*Math.PI/180);

CX[i]=PX[i]-(DS[i]/B[i])*Math.cos(A[i]*Math.PI/180);

//Line start point!!

p1y[i]=CY[i];

p1x[i]=CX[i];

//Line end point!!

p2y[i]=CY[i]+1*Math.sin(D[i]*Math.PI/180);

p2x[i]=CX[i]+1*Math.cos(D[i]*Math.PI/180);

L[i]=(p2x[i]-p1x[i])*(p2x[i]-p1x[i])+(p2y[i]-p1y[i])*(p2y[i]-p1y[i]);

//Travelling towards if SH is less than zero.

SH[i]=2*((p2x[i]-p1x[i])*(p1x[i]-TX)+(p2y[i]-p1y[i])*(p1y[i]-TY));

TD[i]=TX*TX+TY*TY+p1x[i]*p1x[i]+p1y[i]*p1y[i]-2*(TX*p1x[i]+TY*p1y[i])-R1*R1;//OK!

//Contact possible if IL is greater than zero!

IL[i]=SH[i]*SH[i]-4*L[i]*TD[i];

ILS[i]=Math.sqrt(IL[i]);

HT[i]=(-SH[i]-ILS[i])/(2*L[i]);

HX[i]=p1x[i]+HT[i]*(p2x[i]-p1x[i]);//Contact point x.

HY[i]=p1y[i]+HT[i]*(p2y[i]-p1y[i]);//Contact point y. 

//Required angle.

a1= HY[i]-TY;

a2= HX[i]-TX;

I[i]=Math.atan2(a1,a2)*180/Math.PI;

if (I[i] < 0) I[i]+=360;

//Distance to impact point.

d1=HY[i]-CY[i];

d2=HX[i]-CX[i];

P[i]=Math.floor(Math.sqrt(d1*d1+d2*d2)*2);

//Error adjust. For this situation only!

if (Q[i] <= 0) Q[i]=0;

if (SP[i] == 0) Q[i]=0;

E=(R1 > R2)?SP[i]*2:SP[i];

 

if ((P[i] <= E) && (IL[i] > 1) && (SH[i] < 0)){

SP[i]=0;

Y[i]=(TY-R2)+CR[i]*Math.sin(I[i]*Math.PI/180);

X[i]=(TX-R2)+CR[i]*Math.cos(I[i]*Math.PI/180);

}

if ((Q[i] == 0) && (SH[i] <= -1)){

D[i]=A[i]*2-180-D[i];

SP[i]=SP2[i];

}

if (D[i] < 0) D[i]+=360;

Y[i]+=SP[i]*Math.sin(D[i]*Math.PI/180);

X[i]+=SP[i]*Math.cos(D[i]*Math.PI/180);

VB=180-D[i];

HB=0-D[i];

//Edge rebounds!

if(Y[i]<1){Y[i]=1;D[i]=HB} 

if(Y[i]+S[i]>H){Y[i]=H-S[i];D[i]=HB} 

if(X[i]<1){X[i]=1;D[i]=VB}     

if(X[i]+S[i]>W){X[i]=W-S[i];D[i]=VB}

//Corner rebounds! not necessary but looks nice.

if((Y[i]<1)&&(X[i]<1)){Y[i]=1;X[i]=1;D[i]=45}

if((Y[i]<1)&&(X[i]+S[i]>W)){Y[i]=1;X[i]=W-S[i];D[i]=135}

if((Y[i]+S[i]>H)&&(X[i]<1)){Y[i]=H-S[i];X[i]=1;D[i]=315}

if((Y[i]+S[i]>H)&&(X[i]+S[i]>W)){Y[i]=H-S[i];X[i]=W-S[i];D[i]=225}

T2.top=Y[i];

T2.left=X[i];

}//end loop!

setTimeout('Move()',20);

}

//-->

</script>

 

 

 

第二步:把<body>中的内容改为:

<body onload="Move()">

 

0 Comments

Tue

03

Mar

2009

75、浮动的几个会变色的层

75、浮动的几个会变色的层

脚本说明:

把如下代码加入<body>区域中

<style type="text/css">

.clWin{position:absolute; z-index:2; visibility:hidden; overflow:hidden; background-color:blue}

.clWindow{position:absolute; background-color:blue; overflow:hidden; z-index:15; width:200}

.clWinHead{position:absolute; width:200; top:0; font-family:arial,arial,helvetica; font-size:11px; font-weight:bold; color:white; background-color:transparent}

.clText{position:absolute; z-index:50; font-family:arial,helvetica; font-size:11px; background-color:transparent}

.clWinResize{position:absolute; z-index:30; width:30; height:30; clip:rect(0,30,30,0); background-image:url(resize.gif); layer-background-image:url(resize.gif)}

.clLogo{position:absolute}

.clUp{position:absolute; width:12; height:12; z-index:60;}

.clDown{position:absolute; width:12; height:12; z-index:60;}

.clWinButtons{position:absolute; font-family:arial,helvetica; font-size:12px}

</style>

<script language="JavaScript" type="text/javascript">

 

function lib_bwcheck(){ //Browsercheck (needed)

       this.ver=navigator.appVersion

       this.agent=navigator.userAgent

       this.dom=document.getElementById?1:0

       this.opera5=this.agent.indexOf("Opera 5")>-1

       this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;

       this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;

       this.ie4=(document.all && !this.dom && !this.opera5)?1:0;

       this.ie=this.ie4||this.ie5||this.ie6

       this.mac=this.agent.indexOf("Mac")>-1

       this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;

       this.ns4=(document.layers && !this.dom)?1:0;

       this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)

       return this

}

var bw=new lib_bwcheck()

 

 

var oWin=new Array; oWin.zIndex=10; oWin.dragobj=-1; oWin.resizeobj=-1; oWin.zIndex=100

//Start Variables to set ******************************************************************

 

//This script works in IE4+, NS4+ and Opera5.

//Just remember that NS4 and Opera5 does not reflow the content when you resize the windows.

 

 

oWin.bordercolor="#935591" //Remember that you have to change the images as well if you change this color

oWin.bgcolor="red" //Default background color

oWin.bgcoloron="blue"  //The "active" background color

oWin.bgscroll="#C1A9C0" //The background-color for the scroll area"

 

//The rest of the style variables have to be set in the stylesheet above.

//To change styles on the text change .clText

 

//If you change these variables I assume you would like to change the images, image sizes and the imagemap for

//the windows. If so you'll have to do that manually in the addWindow function for now.

 

oWin.bottomh=10 //The height of the bottom "border"

oWin.headh=15 //The height of the head "border"

oWin.bordersize=1 //The left and right bordersize

oWin.scrollw=13 //The width of the scroll area

oWin.scrollimgh=12 //The width of the scroll images

oWin.buttonsw=39 //The width of the buttons image

oWin.resizeh=9 //The width of the resize img

oWin.resizew=13 //The height of the resize img

 

oWin.starty=5 //If you have a header or something on the page that you want the setWindows and the dragdrop to care about set it here.

oWin.defwidth=200 //Default width for the windows if nothing is spesified

oWin.defheight=200 //Default height for the windows if nothing is spesified

oWin.between=15 //This variable controls how much space there will be between the windows when you use setWindows

 

//Set this variable to 1 if you want to be able to control the area the windows can be scrolled.

oWin.keepinside=0 //VALUE: 1 || 0

       oWin.maxX=500 //This is the maximum X value the windows can go to. Set this to "winpage.x2" to keep them inside the window. VALUE: "winpage.x2" || px

       oWin.maxY=500 //This is the maximum Y value the windows can go to. Set this to "winpage.y2" to keep them inside the window. VALUE: "winpage.y2" || px

       oWin.minX=50 //This is the minimun X value the windows can go to. Set to 0 to keep them inside the window. VALUE: px

       oWin.minY=50 //This is the minimum Y value the windows can go to. Set to 0 to keep them inside the window. VALUE: px

 

      

//In the next version of this script all variables can be set on each individual window as well

 

//End Variables to set ********************************************************************

 

function lib_bwcheck(){ //Browsercheck (needed)

       this.ver=navigator.appVersion

       this.agent=navigator.userAgent

       this.dom=document.getElementById?1:0

       this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;

       this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;

       this.ie4=(document.all && !this.dom)?1:0;

       this.ie=this.ie4||this.ie5||this.ie6

       this.mac=this.agent.indexOf("Mac")>-1

       this.opera5=this.agent.indexOf("Opera 5")>-1

       this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;

       this.ns4=(document.layers && !this.dom)?1:0;

       this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)

       return this

}

var bw=new lib_bwcheck();

//Uncomment the next line if you want the user to be sent to another page if he's using an old browser

//if(!bw.bw) location.href='sorry.html'

 

function lib_doc_size(){ //Page positions - needed!

       this.x=0;this.x2=bw.ie && document.body.offsetWidth-20||innerWidth||0;

       if(bw.ns6) this.x2-=2

       this.y=0;this.y2=bw.ie && document.body.offsetHeight-5||innerHeight||0;

       if(bw.ns6) this.y2-=4

       if(!this.x2||!this.y2) return message('Document has no width or height')

       this.x50=this.x2/2;     this.y50=this.y2/2;

       this.x10=(this.x2*10)/100;this.y10=(this.y2*10)/100

       this.ytop=140*100/this.y2

       this.avail=(this.y2*(100-this.ytop))/100

       this.origy=this.y2

       return this;

}

function lib_moveIt(x,y){this.x=x;this.y=y; this.css.left=x;this.css.top=y}

function lib_moveBy(x,y){this.moveIt(this.x+x,this.y+y)}

function lib_showIt(){this.css.visibility="visible"}

function lib_hideIt(){this.css.visibility="hidden"}

function lib_bg(color){

       if(bw.opera5) this.css.background=color

       else if(bw.dom || bw.ie4) this.css.backgroundColor=color

       else if(bw.ns4) this.css.bgColor=color 

}

function lib_clipTo(t,r,b,l,setwidth){

       if(t<0)t=0;if(r<0)r=0;if(b<0)b=0;if(b<0)b=0

       this.ct=t; this.cr=r; this.cb=b; this.cl=l

       if(bw.ns4){

              this.css.clip.top=t;this.css.clip.right=r

              this.css.clip.bottom=b;this.css.clip.left=l

       }else if(bw.opera5){this.css.pixelWidth=r; this.css.pixelHeight=b; this.w=r; this.h=b

       }else{

              this.css.clip="rect("+t+","+r+","+b+","+l+")";

              if(setwidth){this.css.width=r; this.css.height=b; this.w=r; this.h=b}

       }

}

function lib_writeIt(text,startHTML,endHTML){

       if(bw.ns4){

              if(!startHTML){startHTML=""; endHTML=""}

              this.ref.open("text/html"); this.ref.write(startHTML+text+endHTML); this.ref.close()

       }else this.evnt.innerHTML=text

}

//Default lib functions

function lib_obj(obj,nest,dnest,ddnest,num){

       if(!bw.bw) return lib_message('Old browser')

       if(!bw.ns4) this.evnt=bw.dom && document.getElementById(obj)||bw.ie4 && document.all[obj]

       else{

              if(ddnest){this.evnt=document[nest].document[dnest].document[ddnest].document[obj]?document[nest].document[dnest].document[ddnest].document[obj]:0;

              }else if(dnest){this.evnt=document[nest].document[dnest].document[obj]?document[nest].document[dnest].document[obj]:0;

              }else if(nest){this.evnt=document[nest].document[obj]?document[nest].document[obj]:0;

              }else{this.evnt=document.layers[obj]?document.layers[obj]:0;}

       }

       if(!this.evnt) return lib_message('The layer does not exist ('+obj+') - Exiting script\n\nIf your using Netscape please check the nesting of your tags!')

       this.css=bw.dom||bw.ie4?this.evnt.style:this.evnt; 

       this.ref=bw.dom||bw.ie4?document:this.css.document;  

       this.moveIt=lib_moveIt; this.moveBy=lib_moveBy;

       this.showIt=lib_showIt; this.hideIt=lib_hideIt;

       this.bg=lib_bg; this.num=num; this.writeIt=lib_writeIt;    

       this.clipTo=lib_clipTo;   this.obj = obj + "Object";     eval(this.obj + "=this")

       return this

}

/*****************************************************************************

Creating windows

*****************************************************************************/

function create_window(i,x,y,w,h,bg,bga){

       if(!w) w=oWin.defwidth; if(!h) h=oWin.defheight

       if(!bg) bg=oWin.bgcolor; if(!bga) bga=oWin.bgcoloron

       oWin[i]=new lib_obj('divWin'+i,"","","",i)

       oWin[i].oWindow=new lib_obj('divWindow'+i,'divWin'+i)

       oWin[i].oWindow.moveIt(oWin.bordersize,oWin.headh)

       oWin[i].oText=new lib_obj('divWinText'+i,'divWin'+i,'divWindow'+i)

       oWin[i].oHead=new lib_obj('divWinHead'+i,'divWin'+i)

       oWin[i].oButtons=new lib_obj('divWinButtons'+i,'divWin'+i)

       oWin[i].oResize=new lib_obj('divWinResize'+i,'divWin'+i)

       oWin[i].oHead.evnt.onmouseover=new Function("w_mmover("+i+")")

       oWin[i].oHead.evnt.onmouseout=new Function("w_mmout()")

       if(!bw.ns4) oWin[i].oHead.evnt.ondblclick=new Function("mdblclick(0,"+i+")")

       oWin[i].oResize.evnt.onmouseover=new Function("w_mmover("+i+",1)")

       oWin[i].oResize.evnt.onmouseout=new Function("w_mmout()")      

       if(!bw.ns4){

              oWin[i].oHead.css.cursor="move"; oWin[i].oResize.css.cursor="w-resize"

              oWin[i].oWindow.css.overflow="hidden"; oWin[i].css.overflow="hidden"

              oWin[i].oText.css.overflow="hidden"

       }           

       oWin[i].defbg=bg; oWin[i].defbga=bga      

       oWin[i].bg(oWin.bordercolor); oWin[i].oWindow.bg(oWin[i].defbg)

       oWin[i].oUp=new lib_obj('divWinUp'+i,'divWin'+i); oWin[i].oDown=new lib_obj('divWinDown'+i,'divWin'+i)

       oWin[i].oUp.bg(oWin.bgscroll); oWin[i].oDown.bg(oWin.bgscroll);

       oWin[i].lastx=x;oWin[i].lasty=y;oWin[i].origw=w; oWin[i].origh=h

       oWin[i].resize=win_resize;    oWin[i].close=win_close; oWin[i].maximize=win_maximize;

       oWin[i].minimize=win_minimize; oWin[i].regwin=win_regwin; oWin[i].checkscroll=win_checkscroll;

       oWin[i].up=win_up;      oWin[i].down=win_down;     oWin[i].addZ=win_addZ;      oWin[i].state="reg"

       oWin[i].moveIt(x,y); oWin[i].resize(w,h); oWin[i].checkscroll();

       if(bw.opera5) setTimeout("oWin["+i+"].resize("+w+","+h+"); oWin["+i+"].showIt()",10)

       else oWin[i].showIt()

}

/*****************************************************************************

Window functions

*****************************************************************************/

function win_regwin(){

       this.oResize.css.visibility="inherit"

       this.resize(this.origw,this.origh)

       this.moveIt(this.lastx,this.lasty)

       this.state="reg"; this.addZ()

       this.checkscroll()

}

function win_maximize(){

       if(this.state!="max"){

              if(this.state!="min"){this.lastx=this.x; this.lasty=this.y}

              mw=winpage.x2 - 10; mh=winpage.y2 - 10 - oWin.starty

              this.moveIt(5,5+oWin.starty,30,10)

              this.resize(mw,mh); this.oResize.showIt(); this.state="max"

              this.addZ()

       }else this.regwin()

}

function win_minimize(){

       if(this.state!="min"){ couns=0

              if(this.state!="max"){this.lastx=this.x; this.lasty=this.y}

              y=winpage.y2-oWin.headh; ox=winpage.x2-126; a=0

              for(i=0;i<wins;i++){

                     x=i*125; ok=a

                     if(a*125>ox){if(ox>126) i=0; a=0; y-=oWin.headh; x=0}

                     for(j=0;j<wins;j++){

                            couns++; if(oWin[j].x==x && oWin[j].y==y) a++

                     }if(a==ok) break;

              }x=a*125;

              this.moveIt(x,y); this.oResize.hideIt()

              this.state="min"; this.resize(125,oWin.headh)

       }else this.regwin()

}

function win_close(){this.hideIt(); this.oUp.hideIt(); this.oDown.hideIt()}

function win_resize(w,h){

       this.oButtons.moveIt(w-oWin.buttonsw,0); this.oResize.moveIt(w-oWin.resizew,h-oWin.resizeh)

       this.oWindow.clipTo(0,w-oWin.bordersize*2,h-oWin.bottomh-oWin.headh,0,1); this.clipTo(0,w,h,0,1)

       this.oHead.clipTo(0,w,oWin.headh,0,1); this.oText.moveIt(2,3)

       this.oUp.hideIt(); this.oDown.hideIt()

}

function win_checkscroll(w,h){

       this.oText.height=this.oText.evnt.offsetHeight||this.oText.css.pixelHeight||this.oText.ref.height||0

       w=this.cr; h=this.cb

       if(this.oText.height>h-oWin.bottomh-oWin.headh && this.state!="min"){

              this.oWindow.clipTo(0,w-oWin.scrollw-oWin.bordersize*2,h-oWin.bottomh-oWin.headh,0,1);

              this.oUp.moveIt(w-oWin.scrollw,oWin.headh)

              this.oUp.clipTo(0,oWin.scrollw-oWin.bordersize,h-oWin.bottomh-oWin.scrollimgh-oWin.headh,0,1);

              this.oDown.moveIt(w-oWin.scrollw,h-oWin.bottomh-oWin.scrollimgh)

              this.oDown.clipTo(0,oWin.scrollw-oWin.bordersize,oWin.scrollimgh,0,1); this.oUp.showIt()

              this.oDown.showIt()

       }else{this.oUp.hideIt(); this.oDown.hideIt()}

}

var sctim=100;

var winScroll;

function win_up(){

       clearTimeout(sctim);

       if(this.oText.y>=this.oWindow.cb-this.oText.height-10 && winScroll){

              this.oText.moveBy(0,-8);

              setTimeout(this.obj+".up()",30)

       }

}

function win_down(){

       clearTimeout(sctim);

       if(this.oText.y<=0 && winScroll){

              this.oText.moveBy(0,8);

              setTimeout(this.obj+".down()",30)

       }

}

function noScroll(){clearTimeout(sctim);winScroll=false}

function win_addZ(){oWin.zIndex++; this.css.zIndex=oWin.zIndex}

/*****************************************************************************

Initiating winpage

*****************************************************************************/

function win_init(){

       if(document.layers){

              document.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN | Event.MOUSEUP | Event.DBLCLICK)

              document.ondblclick=mdblclick;

       }

       document.onmousemove=mmove;document.onmousedown=mdown;document.onmouseup=mup;

}

/*****************************************************************************

Event functions

*****************************************************************************/

function w_mmover(num,resize){if(!resize) oWin.dragover=num; else oWin.resizeover=num}

function w_mmout(){oWin.dragover=-1; oWin.resizeover=-1}

function mup(e){ //Mouseup

       if((oWin.dragobj!=-1 || oWin.resizeobj!=-1) && oWin.setposition) setPos();

       if(oWin.dragobj!=-1){oWin[oWin.dragobj].lastx=oWin[oWin.dragobj].x; oWin[oWin.dragobj].lasty=oWin[oWin.dragobj].y}

       oWin.dragobj=-1   

       if(oWin.resizeobj!=-1){

              oWin[oWin.resizeobj].checkscroll()

              oWin[oWin.resizeobj].origw=oWin[oWin.resizeobj].cr

              oWin[oWin.resizeobj].origh=oWin[oWin.resizeobj].cb             

       }else if(bw.ns4) routeEvent(e)            

       oWin.resizeobj=-1

}

function mdown(e){ //Mousedown

       x=(bw.ns4 || bw.ns6)?e.pageX:event.x||event.clientX

    y=(bw.ns4 || bw.ns6)?e.pageY:event.y||event.clientY

       if(bw.ie5 || bw.ie6) y+=document.body.scrollTop

       id1=oWin.dragover

       id2=oWin.resizeover

       if(id1>-1 || id2>-1){

              if(id2>-1){ id=id2; oWin.resizeobj=id;

              }else{

                     id=id1; oWin.dragobj=id

                     oWin.clickedX=x-oWin[id].x;

                     oWin.clickedY=y-oWin[id].y

              }

              oWin[id].addZ()

              //Setting background-colors  

              for(i=0;i<wins;i++){

                     if(i!=id1&&i!=id2){

                            oWin[i].oWindow.bg(oWin[i].defbg)

                     }else oWin[i].oWindow.bg(oWin[i].defbga)

              }

       }else if(bw.ns4) routeEvent(e)

       if(!bw.ns4) return false   

}

function mmove(e,y,rresize){ //Mousemove

       x=(bw.ns4 || bw.ns6)?e.pageX:event.x||event.clientX

    y=(bw.ns4 || bw.ns6)?e.pageY:event.y||event.clientY

       if(bw.ie5 || bw.ie6) y+=document.body.scrollTop

       id1=oWin.dragobj

       id2=oWin.resizeobj

       if(id2>-1){ //Resize

              nx=x; ny=y

              oldw=oWin[id2].cr; oldh=oWin[id2].cb

              cw= nx -oWin[id2].x; ch= ny - oWin[id2].y

              if(cw<120) cw=120; if(ch<100) ch=100

              oWin[id2].resize(cw,ch)

       }else if(id1>-1){ //Move

              nx=x-oWin.clickedX; ny=y-oWin.clickedY

              if(ny<oWin.starty) ny=oWin.starty

              if(oWin.keepinside){

                     if(nx+oWin[id1].cr>eval(oWin.maxX)) nx=eval(oWin.maxX)-oWin[id1].cr

                     else if(nx<eval(oWin.minX)) nx=eval(oWin.minX)

                     if(ny+oWin[id1].cb>eval(oWin.maxY)) ny=eval(oWin.maxY)-oWin[id1].cb

                     else if(ny<eval(oWin.minY)) ny=eval(oWin.minY)

              }

              oWin[id1].moveIt(nx,ny)

              if(oWin[id].state==0){oWin[id].lastx=nx; oWin[id].lasty=ny}

       }

       if(!bw.ns4) return false     

}

function mdblclick(e,num){if(num>-1) oWin[num].maximize(); else if(oWin.dragover>-1) oWin[oWin.dragover].maximize()}

function setWindows(placeit,rez){

       between=oWin.between

       oWin.rows=Math.round((wins/3)+0.2)

       oWin.columns=1

       j=0;a=0;c=0;

       for(i=0;i<wins;i++){

              if(j==oWin.columns-1){

                     oWin.columns=wins-a<3?wins-a:wins-a==4?2:3

                     if(wins!=1 && a!=0) c++; j=0

              }else if(a!=0) j++

              oWin[i].origw=(winpage.x2-between-(between*oWin.columns))/oWin.columns

              oWin[i].origh=((winpage.y2-3-oWin.starty-(between*oWin.rows))/oWin.rows)

              oWin[i].lastx=oWin[i].origx=oWin[i].origw*(j)+(between*j)+between

              oWin[i].lasty=oWin[i].origy=oWin[i].origh*c+(between*c) + oWin.starty

              oWin[i].resize(oWin[i].origw,oWin[i].origh); oWin[i].moveIt(oWin[i].lastx,oWin[i].lasty)

              oWin[i].showIt(); a++;

       }

}

/*****************************************************************************

Adding window to winpage!

*****************************************************************************/

var lastx,lasty,lastw,lasth

function addWindow(heading,content,x,y,w,h,bg,bga){

       var num=oWin.length; wins=num+1; var str=""

       str+='<div id="divWin'+num+'" class="clWin">\n'

       str+='<div class="clLogo"><img alt="Window Script from DHTMLCentral.com" src="win_logo.gif" width="19" height="18" alt="" border="0" align="top"></div>\n'

       +'<div id="divWinHead'+num+'" class="clWinHead">       '+heading+'</div>\n'

       +'<div id="divWinButtons'+num+'" class="clWinButtons">\n'

              +'<map name="map'+num+'">\n'

                     +'<area shape="rect" coords="26,2,35,11" href="#" alt="Window Script from DHTMLCentral.com"  onclick="oWin['+num+'].close(); return false">\n'

                     +'<area shape="rect" coords="14,2,23,11" href="#" alt="Window Script from DHTMLCentral.com"  onClick="oWin['+num+'].maximize(); return false">\n'

                     +'<area shape="rect" coords="2,2,11,11" href="#" alt="Window Script from DHTMLCentral.com"  onClick="oWin['+num+'].minimize(); return false">\n'

              +'</map>\n'

              +'<img usemap="#map'+num+'" alt="Window Script from DHTMLCentral.com"  src="buttons0726.gif" width="38" height="14" alt="" border="0">\n'

       +'</div>\n'

       +'<div id="divWinResize'+num+'" class="clWinResize">\n'

       +'</div>\n'

       +'<div id="divWindow'+num+'" class="clWindow">\n'

              +'<div id="divWinText'+num+'" class="clText">'

       if(content){

              str+=content+'</div>\n'

              +'</div>\n'

              +'<div id="divWinUp'+num+'" class="clUp"><a href="#" onclick="return false" onmouseover="winScroll=1; oWin['+num+'].down();"  onmouseout="noScroll()"><img src="arrow_up.gif" width="11" height="12" alt="" border="0"></a></div>\n'

              +'<div id="divWinDown'+num+'" class="clDown"><a href="#" onclick="return false" onmouseover="winScroll=1; oWin['+num+'].up();" onmouseout="noScroll()"><img src="arrow_down.gif" width="11" height="12" alt="" border="0"></a></div>\n'

              +'</div>'

       }

       document.write(str)

       if(content) create_window(num,x,y,w,h,bg,bga)

}

function endWin(){

       num=wins-1

       str='\n</div>\n'

       +'</div>\n'

              +'<div id="divWinUp'+num+'" class="clUp"><a href="#" onclick="return false" onmouseover="winScroll=1; oWin['+num+'].down();"  onmouseout="noScroll()"><img src="arrow_up.gif" width="11" height="12" alt="" border="0"></a></div>\n'

              +'<div id="divWinDown'+num+'" class="clDown"><a href="#" onclick="return false" onmouseover="winScroll=1; oWin['+num+'].up();" onmouseout="noScroll()"><img src="arrow_down.gif" width="11" height="12" alt="" border="0"></a></div>\n'

       +'</div>'

       return str

}

</script>

<script>

win_init()

winpage=new lib_doc_size()

 

cn2="<h3>This is content!</h3>So is this.<br><br>More content is coming right up!<br>More content is coming right up! More content is coming right up!<br><br><br>More content is coming right up! More content is coming right up!"

addWindow("Test window 2",cn2,100,100,250,300,"green","silver")

 

 

//String - With all variables

addWindow("Test window 1","My - content - my - content - my content",300,150,100,200)

</script>

 

<script>

//Start window

addWindow("Test window 2")

</script>

<script>

//End window

document.write(endWin())

//Create window (this have to be done manually. Just leave wins-1 in there)

create_window(wins-1,400,400,300,300)

</script>

 

 

0 Comments

Tue

03

Mar

2009

74、页面中的礼花效果

74、页面中的礼花效果

脚本说明:

第一步:把如下代码加入<body>区域中

<SCRIPT language=JavaScript>

 

if(!window.JSFX)

       JSFX=new Object();

 

JSFX.layerNo=0;

/**********************************************************************************/

JSFX.createElem = function(htmlStr, x, y)

{

       var elem = null;

 

      if(document.layers)

       {

              elem=new Layer(2000);

              elem.document.open();

              elem.document.write(htmlStr);

              elem.document.close();

              elem.moveTo(x,y);

              elem.innerHTML = htmlStr;

       }

       else

       if(document.all)

       {

              var xName = "xLayer" + JSFX.layerNo++;

              var txt = "<DIV ID='" + xName

                     + "' STYLE=\"position:absolute;"

                     + "left:"  + x + ";"

                     + "top:"   + y + ";"

                     + "visibility:hidden\">"

                     + htmlStr

                     + "</DIV>";

 

                     document.body.insertAdjacentHTML("BeforeEnd",txt);

 

              elem = document.all[xName];

       }

       else

       if (document.getElementById)

       {

              var xName="xLayer" + JSFX.layerNo++;

              var txt = ""

                     + "position:absolute;"

                     + "left:"  + x + "px;"

                     + "top:"   + y + "px;"

                     + "visibility:hidden";

 

              var newRange = document.createRange();

 

              elem = document.createElement("DIV");

              elem.setAttribute("style",txt);

              elem.setAttribute("id", xName);

 

              document.body.appendChild(elem);

 

              newRange.setStartBefore(elem);

              strFrag = newRange.createContextualFragment(htmlStr);  

              elem.appendChild(strFrag);

       }

 

       return elem;

}

/**********************************************************************************/

JSFX.Layer = function(newLayer, x, y)

{

       if(!newLayer)

              return;

 

       if(x==null)x=0;

       if(y==null)y=0;

 

       if(typeof newLayer == "string")

              this.elem = JSFX.createElem(newLayer, x, y);

       else

              this.elem=newLayer;

 

       if(document.layers)

       {

              this.images=this.elem.document.images;

              this.style = this.elem;

      }

       else

       {

              this.images  = document.images;

              this.style   = this.elem.style;

       }

}

/**********************************************************************************/

JSFX.findLayer = function(theDiv, d)

{

       if(document.layers)

       {

              var i;

              if(d==null) d = document;

              var theLayer = d.layers[theDiv];

              if(theLayer != null)

                     return(theLayer);

              else

                     for(i=0 ; i<d.layers.length ; i++)

                     {

                            theLayer = JSFX.findLayer(theDiv, d.layers[i].document);

                            if(theLayer != null)

                                   return(theLayer);

                     }

              return("Undefined....");

       }

       else

       if(document.all)

              return(document.all[theDiv]);

       else

       if(document.getElementById)

              return(document.getElementById(theDiv));

       else

              return("Undefined.....");

}

var ns4 = (navigator.appName.indexOf("Netscape") != -1 && !document.getElementById);

 

/**********************************************************************************/

/*** moveTo (x,y) ***/

JSFX.Layer.prototype.moveTo = function(x,y)

{

       this.style.left = x+"px";

       this.style.top = y+"px";

}

if(ns4)

       JSFX.Layer.prototype.moveTo = function(x,y) { this.elem.moveTo(x,y); }

/**********************************************************************************/

/*** show()/hide() Visibility ***/

JSFX.Layer.prototype.show          = function()   { this.style.visibility = "visible"; }

JSFX.Layer.prototype.hide           = function()   { this.style.visibility = "hidden"; }

JSFX.Layer.prototype.isVisible     = function()    { return this.style.visibility == "visible"; }

if(ns4)

{

       JSFX.Layer.prototype.show          = function()   { this.style.visibility = "show"; }

       JSFX.Layer.prototype.hide          = function()   { this.style.visibility = "hide"; }

       JSFX.Layer.prototype.isVisible    = function()   { return this.style.visibility == "show"; }

}

/**********************************************************************************/

/*** zIndex ***/

JSFX.Layer.prototype.setzIndex    = function(z)  { this.style.zIndex = z; }

JSFX.Layer.prototype.getzIndex   = function()    { return this.style.zIndex; }

/**********************************************************************************/

/*** BackGround Color ***/

JSFX.Layer.prototype.setBgColor = function(color) { this.style.backgroundColor = color==null?'transparent':color; }

if(ns4)

       JSFX.Layer.prototype.setBgColor       = function(color) { this.elem.bgColor = color; }

/**********************************************************************************/

/*** BackGround Image ***/

JSFX.Layer.prototype.setBgImage       = function(image) { this.style.backgroundImage = "url("+image+")"; }

if(ns4)

       JSFX.Layer.prototype.setBgImage       = function(image) { this.style.background.src = image; }

/**********************************************************************************/

/*** set Content***/

JSFX.Layer.prototype.setContent   = function(xHtml)      { this.elem.innerHTML=xHtml; }

if(ns4)

       JSFX.Layer.prototype.setContent   = function(xHtml)

       {

              this.elem.document.open();

              this.elem.document.write(xHtml);

              this.elem.document.close();

       }

 

/**********************************************************************************/

/*** Clipping ***/

JSFX.Layer.prototype.clip = function(x1,y1, x2,y2){ this.style.clip="rect("+y1+" "+x2+" "+y2+" "+x1+")"; }

if(ns4)

       JSFX.Layer.prototype.clip = function(x1,y1, x2,y2)

       {

              this.style.clip.top    =y1;

              this.style.clip.left    =x1;

              this.style.clip.bottom     =y2;

              this.style.clip.right  =x2;

       }

/**********************************************************************************/

/*** Resize ***/

JSFX.Layer.prototype.resizeTo = function(w,h)

{

       this.style.width       =w + "px";

       this.style.height      =h + "px";

}

if(ns4)

       JSFX.Layer.prototype.resizeTo = function(w,h)

       {

              this.style.clip.width       =w;

              this.style.clip.height       =h;

       }

/**********************************************************************************/

/*** getX/Y ***/

JSFX.Layer.prototype.getX   = function()   { return parseInt(this.style.left); }

JSFX.Layer.prototype.getY   = function()   { return parseInt(this.style.top); }

if(ns4)

{

       JSFX.Layer.prototype.getX   = function()   { return this.style.left; }

       JSFX.Layer.prototype.getY   = function()   { return this.style.top; }

}

/**********************************************************************************/

/*** getWidth/Height ***/

JSFX.Layer.prototype.getWidth           = function()   { return this.elem.offsetWidth; }

JSFX.Layer.prototype.getHeight   = function()   { return this.elem.offsetHeight; }

if(!document.getElementById)

       JSFX.Layer.prototype.getWidth           = function()

      {

              //Extra processing here for clip

              return this.elem.scrollWidth;

       }

 

if(ns4)

{

       JSFX.Layer.prototype.getWidth           = function()   { return this.style.clip.right; }

       JSFX.Layer.prototype.getHeight   = function()   { return this.style.clip.bottom; }

}

</SCRIPT>

 

<SCRIPT language=JavaScript>

 

if(!window.JSFX)

       JSFX=new Object();

 

if(!JSFX.Browser)

       JSFX.Browser = new Object();

 

if(navigator.appName.indexOf("Netscape") != -1)

{

       JSFX.Browser.getCanvasWidth     = function() {return innerWidth;}

       JSFX.Browser.getCanvasHeight    = function() {return innerHeight;}

       JSFX.Browser.getWindowWidth = function() {return outerWidth;}

       JSFX.Browser.getWindowHeight  = function() {return outerHeight;}

       JSFX.Browser.getScreenWidth     = function() {return screen.width;}

       JSFX.Browser.getScreenHeight    = function() {return screen.height;}

       JSFX.Browser.getMinX        = function() {return(pageXOffset);}

       JSFX.Browser.getMinY        = function() {return(pageYOffset);}

       JSFX.Browser.getMaxX        = function() {return(pageXOffset+innerWidth);}

       JSFX.Browser.getMaxY        = function() {return(pageYOffset+innerHeight);}

 

}

else        if(document.all)    {

       JSFX.Browser.getCanvasWidth     = function() {return document.body.clientWidth;}

       JSFX.Browser.getCanvasHeight    = function() {return document.body.clientHeight;}

       JSFX.Browser.getWindowWidth = function() {return document.body.clientWidth;}

       JSFX.Browser.getWindowHeight  = function() {return document.body.clientHeight;}

       JSFX.Browser.getScreenWidth     = function() {return screen.width;}

       JSFX.Browser.getScreenHeight    = function() {return screen.height;}

       JSFX.Browser.getMinX        = function() {return(document.body.scrollLeft);}

       JSFX.Browser.getMinY        = function() {return(document.body.scrollTop);}

       JSFX.Browser.getMaxX        = function() {

              return(document.body.scrollLeft

                     +document.body.clientWidth);

       }

       JSFX.Browser.getMaxY        = function() {

                     return(document.body.scrollTop

                            +document.body.clientHeight);

       }

}

/*** End  ***/

</SCRIPT>

 

<SCRIPT language=JavaScript>

 

JSFX.FireworkDisplay = function(numFireworks)

{

       JSFX.FireworkDisplay.Fireworks = new Array();

       JSFX.FireworkDisplay.running = true;

 

       JSFX.FireworkDisplay.loadImages();

 

       var i=0;

       for(i=0 ; i<numFireworks; i++)

              JSFX.FireworkDisplay.Fireworks[i]=new JSFX.Firework(i, JSFX.FireworkDisplay.fwImages);

 

       setTimeout("JSFX.FireworkDisplay.animate()", 30 );

}

JSFX.FireworkDisplay.loadImages = function()

{

       var i;

       JSFX.FireworkDisplay.fwImages = new Array();

 

       for(i=0 ; i<21 ; i++)

       {

              JSFX.FireworkDisplay.fwImages[i] = new Image();

              JSFX.FireworkDisplay.fwImages[i].src = ""+i+"20020315.gif"

       }

}

JSFX.FireworkDisplay.animate = function()

{

       var i;

       for(i=0 ; i<JSFX.FireworkDisplay.Fireworks.length ; i++)

              JSFX.FireworkDisplay.Fireworks[i].animate();

 

       setTimeout("JSFX.FireworkDisplay.animate()", 30);

}

/*

 * End Class FireworkDisplay

 */

 

/*

 * Class Firework extends Layer

 */

JSFX.Firework = function(fwNo, theImages)

{

       var imgName = "fw"+fwNo;

       var htmlStr = "<IMG SRC='"+theImages[0].src+"' NAME='"+imgName+"'>"

 

       //Call the superclass constructor

       this.superC = JSFX.Layer;

       this.superC(htmlStr, 0, 0);

 

       this.frame              = 0;

       this.state         = "OFF";

       this.fwImages = theImages;

       this.imgName = imgName;

       this.ay            = 0.1;

       this.resizeTo(2,2);

}

JSFX.Firework.prototype = new JSFX.Layer;

 

JSFX.Firework.prototype.animate = function()

{

       if(this.state == "ON")

       {

              this.frame++

              if(this.frame == this.fwImages.length)

              {

                     this.frame = 0;

                     this.state = "OFF";

                     this.hide();

              }

              else

              {

                     this.images[this.imgName].src = this.fwImages[this.frame].src;

              }

       }

       else if(this.state == "OFF")

       {

              var ydiff = JSFX.Browser.getMaxY() - JSFX.Browser.getMinY();

 

              if(ydiff > 800)

                     this.dy = -12;

              else if(ydiff > 600)

                     this.dy = -10;

              else if(ydiff > 400)

                     this.dy = -8;

              else if(ydiff > 300)

                     this.dy = -7;

              else

                     this.dy = -4;

 

              this.dx = Math.random()*-8 + 4;

              this.dy += Math.random()*3;

              this.clip(0,0,2,2);

              this.setBgColor(Math.random()>.33 ? Math.random()>.33 ? "#FF0000" : "#00FF00" : "#0000FF");

 

              this.x=JSFX.Browser.getMaxX()/2;

              this.y=JSFX.Browser.getMaxY()-10;

              this.moveTo(this.x,this.y);

              this.show();

              this.state="TRAVEL";

       }

       else if(this.state == "TRAVEL")

       {

              this.x += this.dx;

              this.y += this.dy;

              this.dy += this.ay;

              this.moveTo(this.x,this.y);

              if(this.dy > -1 && Math.random()<.05)

              {

                     this.state = "ON";

                     this.setBgColor(null);

                     this.clip(0,0,100,100);

                     this.x -=50;

                     this.y -=50;

                     this.moveTo(this.x, this.y);

              }

       }

 

}

/*** If no other script has added it yet, add the ns resize fix ***/

if(navigator.appName.indexOf("Netscape") != -1 && !document.getElementById)

{

       if(!JSFX.ns_resize)

       {

              JSFX.ow = outerWidth;

              JSFX.oh = outerHeight;

              JSFX.ns_resize = function()

              {

                     if(outerWidth != JSFX.ow || outerHeight != JSFX.oh )

                            location.reload();

              }

       }

       window.onresize=JSFX.ns_resize;

}

 

 

</SCRIPT>

<SCRIPT language=JavaScript>

<!--

function JSFX_StartEffects()

{

       JSFX.FireworkDisplay(15);

}

// -->

</SCRIPT>

 

 

第二步:把<body>中的代码改为:

<BODY bgColor=black onload=JSFX_StartEffects()>

 

0 Comments

Tue

03

Mar

2009

73、变化的公告栏

73、变化的公告栏

脚本说明:

第一步:把如下代码加入<body>区域中

<script LANGUAGE="JavaScript1.1">

<!-- JavaScript ??-

 

messages = new Array()

messages[0] = "欢迎来到网页特效代码7stk.com "

messages[1] = "您可以修改本程序并且应用在您的主页上面。"

messages[2] = "但是任何情况下不能用在商业目的!"

messages[3] = "写点什么好呢?。。。。。。"

messages[4] = "除了 我的资源库 以外的任何有关这个社区的问题可以在这里发表"

messages[5] = "是不是非常好记?"

messages[6] = "纷扰的感情纠葛荒废了多少美丽的年华,幸福的时刻几时能够到达?"

messages[7] = "无须等待,与冰点抗衡,调节温度!"

messages[8] = "还写什么好呢? ..."

messages[9] = "写一写我吧! 我实在是没的写了~~"

messages[10] = "我叫dasfasdfasdfsad"

messages[11] = "浓缩时尚风采,拒揽前沿精彩,一切前沿流行资讯尽在这里! "

messages[12] = "繁杂人世的生活可曾为你增添烦恼?"

messages[13] = "远离一方嘈杂,来到这片清雅天地"

messages[14] = "我是为了学习才做站的~"

messages[15] = "如果你是高手,请多多指教。"

messages[16] = "如果你也是和我一样的菜鸟,我们就共同成长吧!"

messages[17] = "对了,我还有一个站,叫网页特效代码"

messages[18] = "地址是http://www.7stk.com"

messages[19] = "现在已经交给我的好友打理,呵呵!"

messages[20] = "非常感谢您访问我的homepage"

messages[21] = "希望您以后能一如既往的支持本站的发展"

 

mescolor = new Array()

mescolor[0] = "000000"

mescolor[1] = "FF0000"

mescolor[2] = "226622"

mescolor[3] = "0000FF"

mescolor[4] = "FFFF00"

 

textfont = new Array()

textfont[0] = "Verdana"

textfont[1] = "Times"

textfont[2] = "Arial"

 

bagcolor = new Array()

bagcolor[0] = "CCCCCC"

bagcolor[1] = "Yellow"

bagcolor[2] = "CCFFFF"

bagcolor[3] = "AAEEFF"

bagcolor[4] = "CCFF88"

bagcolor[5] = "orange"

bagcolor[6] = "99AAFF"

 

var i_messages = 0

var timer

 

function randomposition(range) {       

       return Math.floor(range*Math.random())

}

 

function dotransition() {

    if (document.all) {

        content.filters[i_messages].apply()

        content.innerHTML = "<table width=320 height=180 border=2><tr><td bgcolor="+bagcolor[randomposition(6)]+" style='color:"+mescolor[randomposition(4)]+";font-family:"+textfont[randomposition(2)]+";font-size:30px' align=center valign=middle>"+messages[i_messages]+"</td></tr></table>"

        content.filters[i_messages].play()

        if (i_messages >= messages.length-1) {

            i_messages = 0

        }

        else {

            i_messages++

        }

    }

    timer = setTimeout("dotransition()",3000)  

}

 

// - JavaScript ?- -->

</script>

<DIV id=content style="position: absolute; top:100px; left:10px; width:560px; height:200px; text-align:center; filter: revealTrans(Transition=1, Duration=3) revealTrans(Transition=2, Duration=3) revealTrans(Transition=3, Duration=2)  revealTrans(Transition=4, Duration=2)  revealTrans(Transition=5, Duration=1)  revealTrans(Transition=6, Duration=3)  revealTrans(Transition=7, Duration=2)  revealTrans(Transition=8, Duration=1)  revealTrans(Transition=9, Duration=3)  revealTrans(Transition=10, Duration=1)  revealTrans(Transition=11, Duration=2)  revealTrans(Transition=12, Duration=3)  revealTrans(Transition=13, Duration=1)  revealTrans(Transition=14, Duration=2)  revealTrans(Transition=15, Duration=3)  revealTrans(Transition=16 Duration=1)  revealTrans(Transition=17, Duration=2)  revealTrans(Transition=18, Duration=3) revealTrans(Transition=19, Duration=1) revealTrans(Transition=20, Duration=2) revealTrans(Transition=21, Duration=3) revealTrans(Transition=22, Duration=3)">

<DIV id=source style="position: absolute; top:140; left:10; width:560; color: AAAAAA;text-align:center"></DIV>

<DIV id=nn style="position: absolute; top:20px; left:20px"> </DIV>

 

 

第二步:把<body>中的代码改为:

<body   onload="dotransition()">

 

0 Comments

Tue

03

Mar

2009

72、页面中的超酷效果

72、页面中的超酷效果

脚本说明:

把如下代码加入<body>区域中

<SCRIPT language=VBScript>

<!--

' Sets initial variables and letter starting positions

 

Sub Window_OnLoad()

call SG1.Scale(0.50, 0.50, 0.50)

call SG2.Scale(0.50, 0.50, 0.50)

call SG3.Scale(0.50, 0.50, 0.50)

call SG4.Scale(0.50, 0.50, 0.50)

call SG1.Rotate(0, 0, 0)

call SG2.Rotate(90, 0, 0)

call SG3.Rotate(0, 90, 0)

RotateAll

end sub

 

' sets rotation speed and behavior as well as creating loop

 

Sub RotateAll

Call SG1.Rotate(4,6,2)

Call SG2.Rotate(4,6,2)

Call SG3.Rotate(4,6,2)

Call SG4.Rotate(4,6,2)

FILK = Window.SetTimeOut("Call RotateAll", 10, "VBSCript")

End Sub

-->

</SCRIPT>

 

<BODY bgColor=white>

 

<!--TOOLBAR_START--><!--TOOLBAR_EXEMPT--><!--TOOLBAR_END--><!--Object creates solid light blue E, structured graphic using text set to fill -->

<OBJECT classid=CLSID:369303C2-D7AC-11D0-89D5-00A0C90833E6 id=SG4 style="HEIGHT: 400px; LEFT: 25%; POSITION: absolute; TOP: 25%; WIDTH: 400px; ZINDEX: 0">

<PARAM NAME="Line0001" VALUE="SetLineStyle(0)">

<PARAM NAME="Line0002" VALUE="SetFillColor(164, 164, 255)">

<PARAM NAME="Line0003" VALUE="SetFillStyle(1)">

<PARAM NAME="Line0004" VALUE="SetFont('Arial', 180, 700, 0, 0, 0)">

<PARAM NAME="Line0005" VALUE="Text('7stk.com', -95, 87)">

</OBJECT>

<!--Object creates green outline around solid E, structured graphic using text set to no fill -->

<OBJECT classid=CLSID:369303C2-D7AC-11D0-89D5-00A0C90833E6 id=SG1 style="HEIGHT: 400px; LEFT: 25%; POSITION: absolute; TOP: 25%; WIDTH: 400px; ZINDEX: 0">

<PARAM NAME="Line0001" VALUE="SetLineStyle(1)">

<PARAM NAME="Line0002" VALUE="SetLineColor(0, 0, 0)">

<PARAM NAME="Line0003" VALUE="SetFillStyle(0)">

<PARAM NAME="Line0004" VALUE="SetFont('Arial', 180, 700, 0, 0, 0)">

<PARAM NAME="Line0005" VALUE="Text('7stk.com', -95, 87)">

</OBJECT>

 

<!-- Object creates pink E that loops around -->

<OBJECT classid=CLSID:369303C2-D7AC-11D0-89D5-00A0C90833E6 id=SG3

style="HEIGHT: 300px; LEFT: 25%; POSITION: absolute; TOP: 25%; WIDTH: 400px; ZINDEX: 1">

<PARAM NAME="Line0001" VALUE="SetLineStyle(1)">

<PARAM NAME="Line0002" VALUE="SetLineColor(66,158, 144)">

<PARAM NAME="Line0003" VALUE="SetFillStyle(0)">

<PARAM NAME="Line0004" VALUE="SetFont('Arial', 280, 700, 0, 0, 0)">

<PARAM NAME="Line0005" VALUE="Text('Welcome', -95, 87)">

</OBJECT>

 

<OBJECT classid=CLSID:369303C2-D7AC-11D0-89D5-00A0C90833E6 id=SG2 style="HEIGHT: 400px; LEFT: 25%; POSITION: absolute; TOP: 25%; WIDTH: 400px; ZINDEX: 2">

<PARAM NAME="Line0001" VALUE="SetLineStyle(1)">

<PARAM NAME="Line0002" VALUE="SetLineColor(255, 111,210)">

<PARAM NAME="Line0003" VALUE="SetFillStyle(0)">

<PARAM NAME="Line0004" VALUE="SetFont('Arial', 180, 700, 0, 0, 0)">

<PARAM NAME="Line0005" VALUE="Text('How are you', -95, 0)">

</OBJECT>

0 Comments

Tue

03

Mar

2009

71、流动边框效果的表格

71、流动边框效果的表格

脚本说明:

把如下代码加入<body>区域中

<SCRIPT>

l=Array(6,7,8,9,'a','b','b','c','d','e','f')

Nx=5;Ny=35

t="<table border=0 cellspacing=0 cellpadding=0 height="+((Nx+2)*16)+"><tr>"

for(x=Nx;x<Nx+Ny;x++)

t+="<td width=16 id=a_mo"+x+"> </td>"

t+="</tr><tr><td width=10 id=a_mo"+(Nx-1)+"> </td><td colspan="+(Ny-2)+" rowspan="+(Nx)+"> </td><td width=16 id=a_mo"+(Nx+Ny)+"></td></tr>"

for(x=2;x<=Nx;x++)

t+="<tr><td width=16 id=a_mo"+(Nx-x)+"> </td><td width=16 id=a_mo"+(Ny+Nx+x-1)+"> </td></tr>"

t+="<tr>"

for(x=Ny;x>0;x--)

t+="<td width=16 id=a_mo"+(x+Nx*2+Ny-1)+"> </td>"

document.write(t+"</tr></table>")

var N=Nx*2+Ny*2

function f1(y){

for(i=0;i<N;i++){

c=(i+y)%20;if(c>10)c=20-c

document.all["a_mo"+(i)].bgColor="'#0000"+l[c]+l[c]+"'"}

y++

setTimeout('f1('+y+')','1')}

f1(1)

</SCRIPT>

 

0 Comments

Tue

03

Mar

2009

70、表格做的分割线

70、表格做的分割线

脚本说明:

把如下代码加入<body>区域中

<script>

l=Array(6,7,8,9,'a','b','b','c','d','e','f')

t="<table height=4 width=100% cellspacing=0 cellpadding=0><tr>"

for(x=0;x<40;x++){t+="<td id=a_mo"+x+"></td>"}

document.write(t+"</tr></table>")

function f1(y){for(i=0;i<40;i++){c=(i+y)%20;if(c>10)c=20-c

document.all["a_mo"+(i)].bgColor="'#00"+l[c]+l[c]+"00'"}y++

setTimeout('f1('+y+')',1)}f1(1)

</script>

 

0 Comments

Tue

03

Mar

2009

69、左键的点击来导出隐藏层

69、左键的点击来导出隐藏层

脚本说明:

第一步:把如下代码加入<body>区域中

<STYLE>#slidemenubar {

       BACKGROUND-COLOR:#FF0000;BORDER-BOTTOM: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid;  FONT: bold 12px/20px Verdana; LEFT: -155px; POSITION: absolute; TOP: 10px; WIDTH: 200px; layer-background-color: #FFff00

}

#slidemenubar2 {

       BACKGROUND-COLOR: #FF0000; BORDER-BOTTOM: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid;  FONT: bold 12px/20px Verdana; LEFT: -155px; POSITION: absolute; TOP: 10px; WIDTH: 200px; layer-background-color: #FFff00

}

.word {  font-size: 9pt; line-height: 13pt; color: #ffccdd}

.word1 {  font-size: 8pt; line-height: 13pt; color: #ffccdd}

</STYLE>

 

<font class="word"></font>

<p><font color="#CCCCCC"></font>

  <!-- ************************************************************** -->

</p>

<div id="Layer2" style="position:absolute; left:439px; top:58px; width:227px; height:7px; z-index:2" class="word">

  <font color="#FF0000">请在网页任何地方点击鼠标左键弹出作品菜单,点击鼠标右键让作品菜单消失,X键和Z键也可以。</font></div>

<script LANGUAGE="JavaScript">

window.moveTo(0,screen.availwidth)

var b=screen.availwidth

var count=2;

var a=0

setInterval("go()", 1);

function go(u)

{

count+=1

b=b-1.7*count

if(b<0)

b=0

window.moveTo(b,a)

if(b<=0)

window.moveTo(0,0)

}

function showtip(nulling){

if (document.all){

if (nulling==0&&slidemenubar2.style.pixelLeft==-250)

slidemenubar2.title='Press "x" to expand the menu, "z" to contract it'

else

slidemenubar2.title=''

}

else if (document.layers){

if (nulling==0&&!window.pullit)

window.status='Press "x" to expand the menu, "z" to contract it'

else

window.status=''

}

}

if (document.all)

document.write('<div id="slidemenubar2" style="left:-250" onMouseover="showtip(0)" onMouseout="showtip(1)">')

</SCRIPT>

<LAYER id=slidemenubar onmouseout=showtip(1) onmouseover=showtip(0) left="0">

<div align="center">

  <SCRIPT language=JavaScript1.2 class="word1">

var sitems=new Array()

var sitemlinks=new Array()

sitems[0]="<table width=189 border=0 cellspacing=0 cellpadding=0 height=21 class=word1>"

sitems[1]="<tr>"

sitems[2]="<td>"

sitems[3]="<div align=left>"

sitems[4]="<p align=center><br>"

sitems[5]="请在网页任何地方点击鼠标左键弹出作品菜单,点击鼠标右键让作品菜单消失,X键和Z键也可以。<br>"

sitems[6]="暂时分出这两个类,以后看情况添加改变。</p>"

sitems[7]="<p align=center><br>"

sitems[8]="设计作品<br>"

sitems[9]="<br>"

sitems[10]="文学作品<br>"

sitems[11]="<br>"

sitems[12]="</p>"

sitems[13]="</div>"

sitems[14]="</td>"

sitems[15]="</tr>"

sitems[16]="</table>"

sitems[17]="<table width=100% border=0 cellspacing=0 cellpadding=0>"

sitems[18]="<tr>"

sitems[19]="<td>"

sitems[20]="<div align=center>"

sitems[21]="</div>"

sitems[22]="</td>"

sitems[23]="</tr>"

sitems[24]="</table>"

for(i=0;i<25;i++)

document.write(sitems[i])

 

</SCRIPT>

</div>

<p class="word"> </p>

</LAYER>

<p>

  <SCRIPT language=JavaScript1.2>

 

function regenerate(){

window.location.reload()

}

function regenerate2(){

if (document.layers)

setTimeout("window.onresize=regenerate",400)

}

window.onload=regenerate2

if (document.all){

document.write('</div>')

themenu=document.all.slidemenubar2.style

rightboundary=0

leftboundary=-250

}

else{

themenu=document.layers.slidemenubar

rightboundary=250

leftboundary=0

}

function pull(){

if (window.drawit)

clearInterval(drawit)

pullit=setInterval("pullengine()",50)

}

function draw(){

pullit=""

clearInterval(pullit)

drawit=setInterval("drawengine()",50)

}

function pullengine(){

if (document.all&&themenu.pixelLeft<rightboundary)

themenu.pixelLeft+=15

else if(document.layers&&themenu.left<rightboundary)

themenu.left+=15

else if (window.pullit)

clearInterval(pullit)

}

function drawengine(){

if (document.all&&themenu.pixelLeft>leftboundary)

themenu.pixelLeft-=15

else if(document.layers&&themenu.left>leftboundary)

themenu.left-=15

else if (window.drawit)

clearInterval(drawit)

}

 

if (document.layers)

document.captureEvents(Event.KEYPRESS)

function menuengine(e){

if (document.layers){

if (e.which==120)

pull()

if (e.which==122)

draw()

}

else if (document.all){

if (event.keyCode==120)

pull()

if (event.keyCode==122)

draw()

}

}

document.onkeypress=menuengine

function click() {

if (event.button==1) {

pull()

}else{

draw()

}

}

document.onmousedown=click

</script>

 

第二步:把<body>中的代码改为:

<body   oncontextmenu=self.event.returnValue=false>

0 Comments

Tue

03

Mar

2009

68、突显广告文字

68、突显广告文字

脚本说明:

把如下代码加入<head>区域中

<SCRIPT LANGUAGE="JavaScript1.2">

<!--

//set Interval between each firework display,

var intervals=2000

var sparksOn     = true;

var speed        = 100;

var power        = 3;

 

//Dont change these values-------

var documentWidth=documentHeight=randomx=randomy=leftcorner=topcorner=0

var ns=(document.layers);

var ie=(document.all);

var sparksAflyin = false;

var allDivs      = new Array(10);

var totalSparks  = 0;

//-------------------------------

 

function initAll(){

       if(!ns && !ie){

       sparksOn = false;

       return;

       }

setInterval("firework()",intervals)

 

if (ns)

       document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);

       for(dNum=0; dNum<7; ++dNum){

              if(ie)

                     allDivs[dNum]=eval('document.all.sDiv'+dNum+'.style');

              else

                     allDivs[dNum]=eval('document.layers["sDiv'+dNum+'"]');

       }

}

 

function firework(){

//below code detects the browser dimenions

if (ie){

documentWidth=document.body.clientWidth

documentHeight=document.body.clientHeight

leftcorner=document.body.scrollLeft

topcorner=document.body.scrollTop

}

else if (ns){

documentWidth=window.innerWidth

documentHeight=window.innerHeight

leftcorner=pageXOffset

topcorner=pageYOffset

 

}

//below code randomly generates a set of coordinates that fall within the dimension

randomx=leftcorner+Math.floor(Math.random()*documentWidth)

randomy=topcorner+Math.floor(Math.random()*documentHeight)

 

 

       if(sparksOn){

              if(!sparksAflyin){

                     sparksAflyin=true;

                     totalSparks=0;

                     for(var spark=0;spark<=6;spark++){

                            dx=Math.round(Math.random()*50);

                            dy=Math.round(Math.random()*50);

                            moveTo(spark,randomx,randomy,dx,dy);

                     }

              }

       }

}

 

function moveTo(i,tempx,tempy,dx,dy){

       if(ie){

              if(tempy+80>(document.body.offsetHeight+document.body.scrollTop))

                     tempy=document.body.offsetHeight+document.body.scrollTop-80;

              if(tempx+80>(document.body.offsetWidth+document.body.scrollLeft))

                     tempx=document.body.offsetWidth+document.body.scrollLeft-80;

       }

       if(tempx>-50&&tempy>-50){

              tempx+=dx;tempy+=dy;

              allDivs[i].left=tempx;

              allDivs[i].top=tempy;

              dx-=power;dy-=power;

              setTimeout("moveTo("+i+","+tempx+","+tempy+","+dx+","+dy+")",speed)

       }

       else

              ++totalSparks

       if(totalSparks==7){

              sparksAflyin=false;

              totalSparks=0;

       }

}

window.onload=initAll

//End-->

</script>

<style>

#sDiv0 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:green;}

#sDiv1 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:red;}

#sDiv2 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:blue;}

#sDiv3 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:orange;}

#sDiv4 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:red;}

#sDiv5 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:lightgreen;}

#sDiv6 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:pink;}

</style>

<div id="sDiv0"></div>

<div id="sDiv1"></div>

<div id="sDiv2"></div>

<div id="sDiv3"></div>

<div id="sDiv4"></div>

<div id="sDiv5"></div>

<div id="sDiv6"></div>

 

0 Comments

Tue

03

Mar

2009

67、XML的强大功能

67XML的强大功能

<HTML xmlns:v = "urn:schemas-microsoft-com:vml"><HEAD>

<META NAME="Description" CONTENT="VML Animation - Kaleidoscope">

<META NAME="Keywords" CONTENT="kaleidoscope,dhtml, vml, javascript, jscript, animation">

<OBJECT classid=CLSID:10072CEC-8CC1-11D1-986E-00A0C955B42E id=VMLRender></OBJECT>

<STYLE>v\:* {BEHAVIOR: url(#VMLRender)}</STYLE>

<BODY bgColor=#ffffff onresize=resize() scroll=no>

<div>

<v:rect id=bg

style="HEIGHT:400pt;LEFT:0pt;POSITION:absolute;TOP:0pt;WIDTH:880pt;Z-INDEX:-1"

coordsize = "21600,21600"

fillcolor = "#c797e2">

<v:fill type = "gradient"

color2 = "#971647"

angle = "45"

focus = "100%"

focusposition = ".5,.5"

focussize = "0,0"

method = "linear sigma">

</v:fill>

</v:rect>

</div>

<DIV id=kal style='position:absolute;left:0;top:0;'></DIV>

<DIV ID=frm style="position:absolute;top:0;">

<FORM name="myform">

<TABLE>

<TR>

<TD>

XML的强大功能

</TD>

</TR>

<TR>

<TD>

Number of Points allowed:

</TD>

</TR>

<TR>

<TD>

<INPUT TYPE=CHECKBOX name=spointse CHECKED>Even numbers<BR>

</TD>

</TR>

<TR>

<TD>

<INPUT TYPE=CHECKBOX name=spointso CHECKED>Odd numbers<BR>

</TD>

</TR>

<TR><TD>Number of Stars</TD></TR>

<TR>

<TD>

<OBJECT ID="scrnumstars"

STYLE="position:relative; left:0;top:0;width:196;height:10"

STYLE="border:2px solid #696969;"

codeBase="http://activex.microsoft.com/controls/mspert10.cab"

CLASSID="CLSID:DFD181E0-5E2F-11CE-A449-00AA004A803D">

<PARAM NAME="Max" VALUE="12">

<PARAM NAME="Min" VALUE="1">

<PARAM NAME="Position" VALUE="5">

<PARAM NAME="LargeChange" VALUE="2">

<PARAM NAME="Orientation" VALUE="1">

</OBJECT>

</TD>

</TR>

<TR><TD>Minimum Points</TD></TR>

<TR>

<TD>

<OBJECT ID="scrminpts"

STYLE="position:relative; left:0;top:0;width:196;height:10"

STYLE="border:2px solid #696969;"

codeBase="http://activex.microsoft.com/controls/mspert10.cab"

CLASSID="CLSID:DFD181E0-5E2F-11CE-A449-00AA004A803D">

<PARAM NAME="Max" VALUE="20">

<PARAM NAME="Min" VALUE="3">

<PARAM NAME="Position" VALUE="3">

<PARAM NAME="LargeChange" VALUE="2">

<PARAM NAME="Orientation" VALUE="1">

</OBJECT>

</TD>

</TR>

<TR><TD>Maximum Points</TD></TR>

<TR>

<TD>

<OBJECT ID="scrmaxpts" STYLE="position:relative; left:0;top:0;width:196;height:10" STYLE="border:2px solid #696969;"

codeBase="http://activex.microsoft.com/controls/mspert10.cab" CLASSID="CLSID:DFD181E0-5E2F-11CE-A449-00AA004A803D">

<PARAM NAME="Max" VALUE="20">

<PARAM NAME="Min" VALUE="3">

<PARAM NAME="Position" VALUE="8">

<PARAM NAME="LargeChange" VALUE="2">

<PARAM NAME="Orientation" VALUE="1">

</OBJECT>

</TD>

</TR>

<TR><TD>Max Rotation Speed</TD></TR>

<TR>

<TD>

<OBJECT ID="scrrotspd" STYLE="position:relative; left:0;top:0;width:196;height:10" STYLE="border:2px solid #696969;"

codeBase="http://activex.microsoft.com/controls/mspert10.cab" CLASSID="CLSID:DFD181E0-5E2F-11CE-A449-00AA004A803D">

<PARAM NAME="Max" VALUE="100">

<PARAM NAME="Min" VALUE="0">

<PARAM NAME="Position" VALUE="50">

<PARAM NAME="LargeChange" VALUE="5">

<PARAM NAME="Orientation" VALUE="1">

</OBJECT>

</TD>

</TR>

<TR><TD>Max Expansion Speed</TD></TR>

<TR>

<TD>

<OBJECT ID="screxpspd"

STYLE="position:relative; left:0;top:0;width:196;height:10"

STYLE="border:2px solid #696969;"

codeBase="http://activex.microsoft.com/controls/mspert10.cab"

CLASSID="CLSID:DFD181E0-5E2F-11CE-A449-00AA004A803D">

<PARAM NAME="Max" VALUE="100">

<PARAM NAME="Min" VALUE="0">

<PARAM NAME="Position" VALUE="50">

<PARAM NAME="LargeChange" VALUE="5">

<PARAM NAME="Orientation" VALUE="1">

</OBJECT>

</TD>

</TR>

<TR><TD>Max Colour Speed</TD></TR>

<TR>

<TD>

<OBJECT ID="scrcolspd"

STYLE="position:relative; left:0;top:0;width:196;height:10"

STYLE="border:2px solid #696969;"

codeBase="http://activex.microsoft.com/controls/mspert10.cab"

CLASSID="CLSID:DFD181E0-5E2F-11CE-A449-00AA004A803D">

<PARAM NAME="Max" VALUE="100">

<PARAM NAME="Min" VALUE="0">

<PARAM NAME="Position" VALUE="50">

<PARAM NAME="LargeChange" VALUE="5">

<PARAM NAME="Orientation" VALUE="1">

</OBJECT>

</TD>

</TR>

</TABLE>

</FORM>

</DIV>

 

<script>

 

//globals for HSV to RGB conversion

irpnt=new Array(2,1,0,0,3,2);

igpnt=new Array(3,2,2,1,0,0);

ibpnt=new Array(0,0,3,2,2,1);

 

v_spointse=true;

v_spointso=true;

v_scrnumstars=1;

v_scrminpts=3;

v_scrmaxpts=3;

v_scrrotspd=50;

v_screxpspd=50;

v_scrcolspd=50;

 

//alert(document.myform.spointse.value)

w=0;

h=0;

kx=0;

ky=0;

np=0;

maxpoints=30;

maxstars=12;

ss=new Array(500,490,480,470,460,450,440,430);

numstars=5;

scol=new colour(57,.81,.89);

resize();

initkaleidoscope();

 

window.setInterval("frame();",20);

 

function initkaleidoscope(){

var ok=false;

 

v_spointse=document.myform.spointse.checked;

v_spointso=document.myform.spointso.checked;

v_scrnumstars=document.myform.scrnumstars.value;

v_scrminpts=document.myform.scrminpts.value;

v_scrmaxpts=document.myform.scrmaxpts.value;

v_scrrotspd=document.myform.scrrotspd.value;

v_screxpspd=document.myform.screxpspd.value;

v_scrcolspd=document.myform.scrcolspd.value;

if(v_scrminpts>v_scrmaxpts){

v_scrmaxpts=v_scrminpts;

document.myform.scrmaxpts.value=v_scrmaxpts;

}

 

kal.innerHTML="";

vs="";

for(j=0;j<v_scrnumstars;j++){

if(v_scrminpts==v_scrmaxpts){

np=v_scrminpts;

}

else{

np=v_scrminpts+rnd(v_scrmaxpts-v_scrminpts+1);

if(v_spointse!=true)while(np%2!=1)np=v_scrminpts+rnd(v_scrmaxpts-v_scrminpts+1);

if(v_spointso!=true)while(np%2!=0)np=v_scrminpts+rnd(v_scrmaxpts-v_scrminpts+1);

}

hue=rnd(360);

dhue=rnd(v_scrcolspd/6);

theta=0;

dtheta=Math.random()*v_screxpspd/100;

dr=Math.random()*v_scrrotspd/10;if(rnd(2)==0)dr=-dr;

sp=makestarpath(np,500,250*(Math.sin(theta)-1));

vs+="<v:shape id='V"+j+"' np="+np+" hue="+hue+" dhue="+dhue+" dr="+dr+" theta="+theta+" dtheta="+dtheta+" style='position:absolute;left:0px;top:0px;height:500;width:500;rotation:0;opacity:0.5;' fill='true' stroke='true' coordsize='2500,2500' coordorigin '-1250,-1250' fillcolor='#a8f4f7' strokecolor='#a8f4f7' path='"+sp+"'></v:shape>"

}

kal.innerHTML=vs;

}

 

function frame(){

 

if(v_spointse!=document.myform.spointse.checked ||

v_spointso!=document.myform.spointso.checked ||

v_scrnumstars!=document.myform.scrnumstars.value ||

v_scrminpts!=document.myform.scrminpts.value ||

v_scrmaxpts!=document.myform.scrmaxpts.value ||

v_scrrotspd!=document.myform.scrrotspd.value ||

v_screxpspd!=document.myform.screxpspd.value ||

v_scrcolspd!=document.myform.scrcolspd.value){

initkaleidoscope();

}

else{

for(j=0;j<v_scrnumstars;j++){

S=document.all["V"+j];

//animate colour

hue=parseInt(S.hue);

dhue=parseInt(S.dhue);

hue+=dhue;

if(hue>=360)hue-=360;

S.hue=hue;

scol.h=hue;

scol.hsv2rgb();

S.fillcolor=scol.rgb;

S.strokecolor=scol.rgb;

//animate rotation

r=parseFloat(S.style.rotation);

dr=parseFloat(S.dr);

r+=dr;if(r>=360)r-=360;if(r<0)r+=360;

S.style.rotation=r;

//animate geometry

np=parseInt(S.np);

theta=parseFloat(S.theta);

dtheta=parseFloat(S.dtheta);

theta+=dtheta;if(theta>Math.PI)theta-=2*Math.PI;

sp=makestarpath(np,500,250*(Math.sin(theta)-1));

S.path=sp;

S.theta=theta;

}

}

}

 

//n=number of points

//r1=outer diameter

//r2=inner diameter

function makestarpath(n,r1,r2){

s="";

pa=2*Math.PI/n;

ss1=Math.PI/2;

ss2=ss1-pa/2;

x1=Math.floor(r1*Math.cos(ss1));

y1=Math.floor(-r1*Math.sin(ss1));

x2=Math.floor(r2*Math.cos(ss2));

y2=Math.floor(-r2*Math.sin(ss2));

s="m "+(x2+1250)+","+(y2+1250)+" l ";

for (i=1;i<=n;i++){

if(i>1)s+=","

s+=(x1+1250)+","+(y1+1250)+",";

s1=ss1+i*pa;

s2=ss2+i*pa;

x1=Math.floor(r1*Math.cos(s1));

y1=Math.floor(-r1*Math.sin(s1));

x2=Math.floor(r2*Math.cos(s2));

y2=Math.floor(-r2*Math.sin(s2));

s+=(x2+1250)+","+(y2+1250);

}

s+=" e"

return(s);

}

 

function rnd(n){

return(Math.floor(n*Math.random()));

}

 

function resize(){

w=document.body.clientWidth;

h=document.body.clientHeight;

bg.style.width=w-206;

frm.style.left=w-206;

bg.style.height=h;

kx=w/2-250-103;

ky=h/2-250;

kal.style.left=kx;

kal.style.top=ky;

}

 

//utility object for HSV to RGB conversion

function hsv2rgb(){

pqvt=new Array(4);

with(this){

if(s==0){

r=Math.floor(255*v);

g=r;

b=r;

return;

}

if(h>=360)h=0;

nh=h/60;

i=Math.floor(nh);

f=nh-i;

pqvt[2]=255*v;

pqvt[0]=pqvt[2]*(1-s)

pqvt[1]=pqvt[2]*(1-s*f)

pqvt[3]=pqvt[2]*(1-s*(1-f))

r=Math.floor(pqvt[irpnt[i]]);

g=Math.floor(pqvt[igpnt[i]]);

b=Math.floor(pqvt[ibpnt[i]]);

rgb="#"+(65536*r+256*g+b).toString(16);

}

}

 

function colour(h,s,v){

this.h=h;//0-359

this.s=s;//0-1

this.v=v;//0-1

this.r=0;//0-255

this.g=0;//0-255

this.b=0;//0-255

this.rgb="";

this.hsv2rgb=hsv2rgb;

//convert on construction

this.hsv2rgb();

}

 

setInterval("dis();",50);

 

function dis(){

window.status=document.myform.spointse.checked;

}

</script>

0 Comments

Tue

03

Mar

2009

66、可移动的页面窗口

66、可移动的页面窗口

脚本说明:

第一步:把如下代码加入<body>区域中

<style type="text/css">

body,td,a {  font-size: 9pt; color: #330000; text-decoration: none}

.aa {filter:alpha(opacity=70)}

</style>

<div style="position:absolute; left:235px; top:92px;solid;cursor:move"  onmousedown="down1(this)" class="aa" id=plane0>

<table cellpadding="0" border="0" cellspacing="1" width="200" height="100" bgcolor="#000000" >

<tr><td height="18" bgcolor="#999999" >

<div align="right">点这儿关闭>>><a href="#" onClick="clase(0)"></a></div>

</td></tr><tr>

<td bgcolor="f4f4f4">这里是你的文字!!!!!!!!!!!!!!!!!!</td>

</tr></table></div>

 

<div style="position:absolute;left:350px;top:172px;z-index:1;solid;cursor:move" id=plane1 onmousedown="down1(this)" class="aa">

<table cellpadding="0" border="0" cellspacing="1" width="200" height="100" bgcolor="#000000" >

<tr><td height="18" bgcolor="#999999" >

<div align="right">点这儿关闭>>><a href="javascript:" onClick="clase(1)"></a></div>

</td></tr><tr>

<td bgcolor="f4f4f4">这里是你的文字!!!!!!!!!!!!!!!!!!</td>

</tr></table></div>

 

<script>

var over=false,down=false,divleft,divtop,n;

function clase(x){document.all['plane'+x].style.visibility='hidden'}

function down1(m){

n=m;down=true;divleft=event.clientX-parseInt(m.style.left);divtop=event.clientY-parseInt(m.style.top)}

function move(){if(down){n.style.left=event.clientX-divleft;n.style.top=event.clientY-divtop;}}</script>

把窗口移到这儿看看吧!

 

<a href="javascript:" onClick="plane0.style.visibility='visible'">点这儿重新显示0</a>

<a href="javascript:" onClick="plane1.style.visibility='visible'">点这儿重新显示1</a>

 

 

第二步:把<body>中的内容改为:

<body bgcolor="#fef4d9"  onmousemove="move()" onmouseup="down=false">

0 Comments

Tue

03

Mar

2009

65、3D现象的选择显示

653D现象的选择显示

脚本说明:

第一步:把如下代码加入<body>区域中

<SCRIPT language=javascript>

var i=new Array();m=Math;j=document;da=j.all;r=m.PI/180;u=window;op=0;g=this.location+"";

function c(f){t=0;if(da){if(f){t=j.body.offsetWidth/2}else{t=j.body.offsetHeight/2}}if(t<1){if(da){op=1}if(f){t=u.innerWidth/2}else{t=u.innerHeight/2}}return t}

function no(x,y){i[i.length]=new of(x,y);return (i.length-1)}

function npr(o,x,y,z){i[o].pr[(i[o].pr.length)]=new np(x,y,z)}

function np(x,y,z){this.x=this.x2=x*k;this.y=this.y2=y*k;this.z=this.z2=z*k;}

function of(x,y){this.x=x*k;this.y=y*k;this.pr=new Array()}

function h(u,e){b=""+m.round((u+1)*(999999/e));return "000000".substr(b.length)+b;}

function dp(o,omsg,s){f=ppr(o);for(pID=0;pID<i[o].pr.length;pID++){p=i[o].pr[pID];msg=s==1?'<font size="+5" color="#'+h(pID,i[o].pr.length)+'">'+omsg:omsg;if(da){j.write('<div id="id'+(f+pID)+'" style="position: absolute;">'+msg+'</div>')}else{j.write("<layer top=0 left=0>"+msg+"</layer>")}}}

function rt(o,v1,v2,v3){rtf(o,v1,v2,v3);f=ppr(o);for(pID=0;pID<i[o].pr.length;pID++){up(o,pID,f+pID)}}

function rtf(o,v1,v2,v3){c12=(c1=m.cos(v1*r))*(c2=m.cos(v2*r));c23=c2*(c3=m.cos(v3*r));s1_c3=(s1=m.sin(v1*r))*c3;c2_s3=c2*(s3=m.sin(v3*r));s1_c2=s1*c2;s12_c3=(s13=s1*s3)*c3;c1_s23=(c1_s3=c1*s3)*(s2=m.sin(v2*r));c13_s2=(c13=c1*c3)*s2;s123=s13*s2;for(pID=0;pID<i[o].pr.length;pID++){p=i[o].pr[pID];x2=p.x*c12+p.z*s1_c2-p.y*s2;y2=p.y*c23+p.x*c13_s2+p.z*s12_c3+p.z*c1_s3-p.x*s13;z2=p.z*c13-p.x*s1_c3-p.y*c2_s3-p.x*c1_s23-p.z*s123;p.x=x2;p.y=y2;p.z=z2;}}

function up(o,pID,lID){p=i[o].pr[pID];b=p.z==0?-1:p.z/2;l=i[o].x+(b*p.x/(p.z-b));t=i[o].y+(b*p.y/(p.z-b));if(da){d=da["id"+lID].style;d.pixelLeft=l;d.pixelTop=t;}else{d=j.layers[lID];d.left=l;d.top=t}}

function ppr(o){b=0;for(f=0;f<o;f++){b+=i[f].pr.length}return b}

function mv(o,x,y){i[o].x=x;i[o].y=y}

function ki(arg){if(da){ex=event.clientX;ey=event.clientY}else{ex=arg.pageX;ey=arg.pageY}for(x=0;x<i.length;x++){a[x].x=(ex-i[x].x)/(c(1)*2)*rx;a[x].y=(ey-i[x].y)/(c(0)*2)*ry;}}

function ro(){for(x=0;x<i.length;x++){rt(x,a[x].x,a[x].y,a[x].z)}setTimeout("ro()",0)}

function re(){for(x=0;x<i.length;x++){mv(x,(c(1)*2/(i.length+1))*(x+1),c(0))}if(mc==1){if(op){this.location=g.substr(0,g.lastIndexOf("&"))}else{if(da){j.body.onmousemove=ki}else{u.captureEvents(Event.MOUSEMOVE);u.onmousemove=ki}}}ro()}

function q(){for(x=0;x<i.length;x++){a[x]=mc==1?new np(0,0,0):new np(rx/k,rz/k,ry/k);dp(x,txt,cl);}}

cl=0;o_b=0;o_p=0;o_c=0;mc=0;b=g.substr(g.indexOf("?")+1);if(g==b){j.write('<center><table border=0><form method="get"><tr><td colspan=2><dd><font size=5>3d.js</font></td></tr><tr><td>方向上的数值:</td></tr><tr><td><dd>x-axis</td><td><input type="text" value="2" name="rx"></td></tr><tr><td><dd>y-axis</td><td><input type="text" value="2" name="ry"></td></tr><tr><td><dd>z-axis</td><td><input type="text" value="2" name="rz"></td></tr><tr><td>size</td><td><input type="text" value="4" name="y"></td></tr><tr><td>scaling</td><td><input type="text" value="5" name="k"></td></tr><tr><td>文本样式:</td><td><input type="text" value="." name="txt"></td></tr><tr><td>是否选择颜色:</td><td><input type="checkbox" checked name="cl"></td></tr><tr><td>设置数量:</td></tr><tr><td><dd>个数:</td><td><input type="text" value="20" name="rd"></td></tr><tr><td><dd>层次:</td><td><input type="text" value="17" name="z"></td></tr><tr><tr><td>物件:</td></tr><tr><td><dd>coil</td><td><input type="checkbox" name="o_c"></tr><tr><td><dd>box</td><td><input type="checkbox" name="o_b" checked></td></tr><tr><td><dd>pyramid</td><td><input type="checkbox" name="o_p"></td></tr><tr><td>是否鼠标控制:</td><td><input type="checkbox" name="mc" checked></td></tr><tr><td colspan=2 align="right"><input type="submit" value="draw 3d"></td></tr></form></td></tr></center></table>')}else{b+="&";for(;b.length>0;){p=b.substr(0,b.indexOf("&"));f=p.substr(0,p.indexOf("="));v=p.substr(f.length+1);switch(f){case "txt":txt=v;break;case "o_c":o_c=1;break;case "o_p":o_p=1;break;case "o_b":o_b=1;break;case "cl":cl=1;break;case "mc":mc=1;break;default:eval(f+"="+v);}b=b.substr(b.indexOf("&")+1);}

if(o_c==1){b=no(0,0);for(x=0;x<360*y;x+=z){npr(b,m.cos(x*r)*rd,m.sin(x*r)*rd,(360*y/2-x)/(y*5))}}

if(o_b==1){z=no(0,0);w=y+1;f=w*w+1;b=f/2;for(x=0;x<f;x+=w){npr(z,-b+x,-b,b);npr(z,-b+x,-b,-b);npr(z,-b+x,b,b);npr(z,-b+x,b,-b);npr(z,-b,-b+x,b);npr(z,-b,-b+x,-b);npr(z,b,-b+x,b);npr(z,b,-b+x,-b);npr(z,-b,-b,-b+x);npr(z,-b,b,-b+x);npr(z,b,-b,-b+x);npr(z,b,b,-b+x)}}

if(o_p==1){z=no(0,0);w=y+2;f=w*w+1;b=f/2;for(x=0;x<(f/2);x+=w){npr(z,x,x,-b+x);npr(z,-x,x,-b+x);npr(z,0,-x,-b+x)}for(x=0;x<f;x+=w){npr(z,-b+x,b,1);npr(z,-b+x/2,b-x,1);npr(z,b-x/2,b-x,1)}}var a=new Array();q()}

</SCRIPT>

 

 

 

第二步:把<body>中的内容改为:

<body   onload=javascript:re()>

0 Comments

Tue

03

Mar

2009

64、多层的显示与关闭

64、多层的显示与关闭

脚本说明:

把如下代码加入<body>区域中

<script>

<!-- Begin

// quick browser tests

var ns4 = (document.layers) ? true : false;

var ie4 = (document.all && !document.getElementById) ? true : false;

var ie5 = (document.all && document.getElementById) ? true : false;

var ns6 = (!document.all && document.getElementById) ? true : false;

 

function show(sw,obj) {

       // show/hide the divisions

       if (sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'visible';

       if (!sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'hidden';

       if (sw && ns4) document.layers[obj].visibility = 'visible';

       if (!sw && ns4) document.layers[obj].visibility = 'hidden';

}

// End -->

</script>

 

<style type="text/css">

<!--

.myLayersClass { position: relative; visibility: hidden; }

//-->

</style>

<div id = "div1" class = "myLayersClass">

<h3 align="center">这是第一层的内容</h3>

</div>

 

<div id = "div2" class = "myLayersClass" align="center">

<table width="60%" border="1" cellpadding="5" align="center" bgcolor="Aqua">

<tr><th colspan="2">下面是一个表格</th></tr>

       <td><a href="http://www.sina.com">新浪网</a></td>

      

</tr>

<tr>

       <td><a href="http://www.163.com">网易</a></td>

      

</tr>

<tr>

       <td><a href="http://www.7stk.com">网页特效代码</a></td>

 

</tr>

</table>

</div>

<div id = "div3" class = "myLayersClass" align="center">

<br>下面是一张图片<br>

<img src="rushmore.jpg" height=189 border=0 alt="" width=287>

</div>

<div id="div4" align="center">

<form action="" method="post" name="myForm">

<input type=button value="打开第一层" onClick="show(true,'div1');"> <input type=button value="关闭第一层" onClick="show(false,'div1');"><br><br>

<input type=button value="打开第二层" onClick="show(true,'div2');"> <input type=button value="关闭第二层" onClick="show(false,'div2');"><br><br>

<input type=button value="打开第三层" onClick="show(true,'div3');"> <input type=button value="关闭第三层" onClick="show(false,'div3');"><br><br>

<input type=button value="打印此页" onClick="print()"> <input type=button value="隐藏按钮并打印此页" onClick="show(false,'div4');print();show(true,'div4')"> <input type=button value="显示所有的层" onClick="show(true,'div1'); show(true,'div2'); show(true,'div3')">

</form>

</div>

 

0 Comments

Tue

03

Mar

2009

62、宣传FLASH的隐现

62、宣传FLASH的隐现

脚本说明:

把如下代码加入<body>区域中

<script>

<!--

 

lstart=0

loop=true

speed=85

pr_step=3

newspeed=800

newspeed2=0

 

function makeObj(obj,nest){

       nest=(!nest) ? '':'document.'+nest+'.'

       this.css=(document.layers) ? eval(nest+'document.'+obj):eval(obj+'.style')

       this.scrollHeight=(document.layers) ?

 

this.css.document.height:eval(obj+'.offsetHeight')

       this.scrollWidth=(document.layers) ?

 

this.css.document.width:eval(obj+'.offsetWidth')

       this.up=goUp

       this.obj = obj + "Object"

       eval(this.obj + "=this")

       return this

}

 

function goUp(speed){

       if(parseInt(this.css.top)>-(this.scrollHeight-0)){

              this.css.top=parseInt(this.css.top)-pr_step-1

              //alert("ok")

              setTimeout(this.obj+".up("+speed+")",35)

       }else {

      

              if(navigator.appName == "Netscape")

              {

                     tome=setInterval(this.obj+".setClipne()",50)}

              else{

              tome=setInterval('setClipie()',50)

              tmp=divCont.style.clip;

              }

             

       }

}

 

function setClipne(){

       //this.css.clip.right=this.css.clip.right-pr_step;

       //this.css.clip.left=this.css.clip.left+pr_step;

       //temp=parseInt(this.css.clip.right)-parseInt(this.css.clip.left);

       if(temp==0)

       {clearInterval(tome);

       document.divCont.document.divNews.visibility="hide";

       document.divCont.visibility="hide";

       }

}

 

function setClipie()

{

       newspeed=newspeed-pr_step;

       newspeed2=newspeed2+pr_step;

       temp="rect(0px "+newspeed+"px 600px "+newspeed2+"px)";

       this.css.clip=temp;

       if(newspeed<newspeed2)

       {

      clearInterval(tome);

      divNews.style.display="none"

      divCont.style.display="none"

      }

}

 

function slideInit(){

       oSlide=makeObj('divNews','divCont')

       oSlide.css.top=lstart

       oSlide.up(speed)

}

function myload(){

setTimeout("slideInit()",4000);

}

 

myload()

//-->

</script>

<script language=javascript>

      document.write("<div id=divAll style='position:absolute;'><div id=divCont style='position:absolute; width:386; height:60; top:0; left:-12; clip:rect(0,800,600,0)'><div id=divNews style='position:absolute; top:0; left:10; right:820'><embed src=0091.swf qulity=high width=602 height=525 onload=myload ></embed></div></div></div>");

</script><script language=javascript>

{

       if (navigator.appName == "Netscape")

       {document.write("<layer id=divCont onLoad='moveToAbsolute(layer1.pageX-160,layer1.pageY);clip.height=600;clip.width=800; visibility=\"show\";'><layer id=divNews position:absolute; top:0; left:0><embed src=0091.swf qulity=high width=602 height=25></embed></layer></layer>")

       }

}

</script>

0 Comments

Tue

03

Mar

2009

61、自己选择背景色

61、自己选择背景色

脚本说明:

把如下代码加入<body>区域中

<a href="" onMouseOver="var bg=prompt('你想要什么背景色?');document.bgColor=bg">请选择一种背景色</a>

 

0 Comments