136、鼠标点击效果

136、鼠标点击效果

脚本说明:

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

<SCRIPT>

 

function checkBrowserForVersion4(){

var x = navigator.appVersion;y = x.substring(0,4);

if (y>=4) setVariables();

}

 

function setVariables(){

if (navigator.appName == "Netscape"){h=".left=";v=".top=";dS="document.";sD=""; }

else{h=".pixelLeft=";v=".pixelTop=";dS="";sD=".style";}

 

objectX="object11";XX=-70;YY=-70;OB=11}

 

function setObject(a){objectX="object"+a;OB=a;XX=eval("xpos"+a);YY=eval("ypos"+a);}

function getObject(){if (isNav)document.captureEvents(Event.MOUSEMOVE);}

function releaseObject(){check="no";objectX="object11";document.close()}

function moveOB() {eval(dS+objectX+sD+h+Xpos);eval(dS+objectX+sD+v+Ypos);}

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

var isIE = (navigator.appName.indexOf("Microsoft") !=-1)

check="no"

function MoveHandler(e) {Xpos = (isIE) ? event.clientX : e.pageX

Ypos = (isNav) ? e.pageY : event.clientY

if (check=="no"){

diffX=XX-Xpos;diffY=YY-Ypos;check="yes"

if (objectX=="object11")check="no"}

Xpos+=diffX;Ypos+=diffY

if (OB=="1")xpos1=Xpos,ypos1=Ypos

moveOB();}

if (isNav){

//the window or the document or the layer may capture mousemoves

document.captureEvents(Event.CLICK);document.captureEvents(Event.DBLCLICK);}

xpos1=330;ypos1=90;xpos11=-50;ypos11=-50;Xpos=5;Ypos=5

document.onmousemove = MoveHandler;document.onclick = getObject;

document.ondblclick = releaseObject;

 

</SCRIPT>

<DIV id=object1 style="LEFT: 330px; POSITION: absolute; TOP: 90px; Z-INDEX: 2">

<TABLE border=1 cellPadding=5>

  <TBODY>

  <TR>

    <TD bgColor=#eeeeee>

      <P align=center><A href="javascript:void(0)"

      onmousedown=setObject(1)>按了我只有双击才能甩掉<BR></A>www.7stk.com</P></TD></TR></TBODY></TABLE></DIV>

<DIV id=object11

style="LEFT: -70px; POSITION: absolute; TOP: -70px; Z-INDEX: 2"></DIV>

 

 

 

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

<body bgcolor="#fef4d9" onload=checkBrowserForVersion4();>

 

Write a comment

Comments: 0