
C#文字跟随鼠标移动
1个回答
展开全部
脚本说明:<br>
第一步:把如下代码加入<body>区域中<br>
<SCRIPT LANGUAGE="JavaScript"><br>
<!-- Begin<br>
function mover()<br>
{<br>
document.all.x.style.left = event.clientX;<br>
document.all.x.style.top = event.clientY;<br>
document.all.x1.style.top = event.clientX;<br>
document.all.x1.style.left = event.clientY;<br>
document.all.x2.style.top = event.clientX;<br>
document.all.x2.style.right = event.clientY;<br>
document.all.x3.style.right = event.clientX;<br>
document.all.x3.style.top = event.clientY;<br>
document.all.x4.style.bottom= event.clientX;<br>
document.all.x4.style.right = event.clientY;<br>
document.all.x5.style.bottom= event.clientX;<br>
document.all.x5.style.left = event.clientY;<br>
document.all.x6.style.left= event.clientX;<br>
document.all.x6.style.bottom = event.clientY;<br>
document.all.x7.style.right= event.clientX;<br>
document.all.x7.style.bottom = event.clientY;<br>
}<br>
// End --><br>
</script><br>
<DIV ID = "x", STYLE = "position: absolute; filter: glow(strength = 3, color = red)"> Merry christmas </DIV><br>
<DIV ID = "x1", STYLE = "position: absolute; filter: glow(strength = 3, color = blue)"> Happy new year </DIV><br>
<DIV ID = "x2", STYLE = "position: absolute; filter: glow(strength = 3, color = blue)"> Merry christmas </DIV><br>
<DIV ID = "x3", STYLE = "position: absolute; filter: glow(strength = 3, color = red)"> Happy new year </DIV><br>
<DIV ID = "x4", STYLE = "position: absolute; filter: glow(strength = 3, color = green)"> Merry christmas </DIV><br>
<DIV ID = "x5", STYLE = "position: absolute; filter: glow(strength = 3, color = green)"> Happy new year </DIV><br>
<DIV ID = "x6", STYLE = "position: absolute; filter: glow(strength = 3, color = purple)"> Merry christmas </DIV><br>
<DIV ID = "x7", STYLE = "position: absolute; filter: glow(strength = 3, color = purple)"> Happy new year </DIV><br>
<br>
<br>
第二步:把<body>中的内容改为:<br>
<body ONMOUSEMOVE="mover()"><br>
第一步:把如下代码加入<body>区域中<br>
<SCRIPT LANGUAGE="JavaScript"><br>
<!-- Begin<br>
function mover()<br>
{<br>
document.all.x.style.left = event.clientX;<br>
document.all.x.style.top = event.clientY;<br>
document.all.x1.style.top = event.clientX;<br>
document.all.x1.style.left = event.clientY;<br>
document.all.x2.style.top = event.clientX;<br>
document.all.x2.style.right = event.clientY;<br>
document.all.x3.style.right = event.clientX;<br>
document.all.x3.style.top = event.clientY;<br>
document.all.x4.style.bottom= event.clientX;<br>
document.all.x4.style.right = event.clientY;<br>
document.all.x5.style.bottom= event.clientX;<br>
document.all.x5.style.left = event.clientY;<br>
document.all.x6.style.left= event.clientX;<br>
document.all.x6.style.bottom = event.clientY;<br>
document.all.x7.style.right= event.clientX;<br>
document.all.x7.style.bottom = event.clientY;<br>
}<br>
// End --><br>
</script><br>
<DIV ID = "x", STYLE = "position: absolute; filter: glow(strength = 3, color = red)"> Merry christmas </DIV><br>
<DIV ID = "x1", STYLE = "position: absolute; filter: glow(strength = 3, color = blue)"> Happy new year </DIV><br>
<DIV ID = "x2", STYLE = "position: absolute; filter: glow(strength = 3, color = blue)"> Merry christmas </DIV><br>
<DIV ID = "x3", STYLE = "position: absolute; filter: glow(strength = 3, color = red)"> Happy new year </DIV><br>
<DIV ID = "x4", STYLE = "position: absolute; filter: glow(strength = 3, color = green)"> Merry christmas </DIV><br>
<DIV ID = "x5", STYLE = "position: absolute; filter: glow(strength = 3, color = green)"> Happy new year </DIV><br>
<DIV ID = "x6", STYLE = "position: absolute; filter: glow(strength = 3, color = purple)"> Merry christmas </DIV><br>
<DIV ID = "x7", STYLE = "position: absolute; filter: glow(strength = 3, color = purple)"> Happy new year </DIV><br>
<br>
<br>
第二步:把<body>中的内容改为:<br>
<body ONMOUSEMOVE="mover()"><br>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询