📄 picfollow.htm
字号:
<html>
<head>
<title>洪恩在线 - Javascript实例</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../homepage.css">
<script language=javascript>
if(document.layers)
{
alert("此效果在Netscape浏览器中不能实现!");
}
</script>
</head>
<body bgcolor="#FFFFFF" >
<script language="Javascript" src="/pub/js/head.js"></script>
<table width="760" height="20" border=0 cellspacing="0" cellpadding="0" align="center" >
<tr bgcolor="CFDFFF">
<td height=20 class="p1" align="left"><img src="/pc/img/blank.gif" width="12" height="8"><font color="#000000"><font color="#FF9966">当前位置</font>:<a href="/default.htm" class="under">洪恩在线</a>
-> <a href="/pc/index.htm" class="under">电脑乐园</a> -> JavaScript实例</font></td>
</tr>
</table>
<script language="JavaScript">
var newtop=0
var newleft=0
if (navigator.appVersion.indexOf("MSIE") != -1) {
layerStyleRef="layer.style.";
layerRef="document.all";
styleSwitch=".style";
}
function doMouseMove() {
layerName = 'iit'
eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')
eval('curElement'+styleSwitch+'.visibility="visible"')
eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')
eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')
eval('height=curElement'+styleSwitch+'.height')
eval('width=curElement'+styleSwitch+'.width')
width=parseInt(width)
height=parseInt(height)
if (event.clientX > (document.body.clientWidth - 5 - width))
{
newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width
}
else
{
newleft=document.body.scrollLeft + event.clientX
}
eval('curElement'+styleSwitch+'.pixelLeft=newleft')
if (event.clientY > (document.body.clientHeight - 5 - height))
{
newtop=document.body.clientHeight + document.body.scrollTop - 5 - height
}
else
{
newtop=document.body.scrollTop + event.clientY
}
eval('curElement'+styleSwitch+'.pixelTop=newtop')
}
document.onmousemove = doMouseMove;
</script>
<script language="javascript">
if (navigator.appVersion.indexOf("MSIE") != -1) {
document.write('<div ID=OuterDiv>')
document.write('<img ID=iit src="img/rabbit.gif" STYLE="position:absolute;TOP:0pt;LEFT:0pt;Z-INDEX:2;visibility:hidden;">')
document.write('</div>')
}
</script>
<table width="760" border=0 cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="207" valign="top"><img src="img/bule.gif" width="207" height="13"></td>
<td bgcolor="A8A8AB" width="1"><img src="img/blank.gif" width="1" height="1"></td>
<td align="right" height="22" width=530><img src="img/js.gif" width="186" height="20"></td>
<td width="22"><img src="img/blank.gif" width="1" height="1"></td>
</tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="124"><img src="img/blank.gif" width="1" height="1"></td>
<td background="img/line.gif" height="27" width=636><img src="img/blank.gif" width="1" height="1"></td>
</tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class=p3 align="center" width=711><b> 图形跟随鼠标</b></td>
<td class="p2" width="1" bgcolor="A8A8AB"><img src="img/blank.gif" width="1" height="1"></td>
<td class="p2" width="48"> </td>
</tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="center" valign="top"> </td>
<td> </td>
<td bgcolor="5F74BF" width="28" align="center"><img src="img/bule1.gif" width="28" height="49"></td>
<td width="37" align="center"> </td>
</tr>
<tr>
<td align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td>
<table width="110" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="5F74BF" align="center">
<td class="p1" align="right"><b><font color="#FFFFFF">效 果 演 示</font></b><font color="#FFFFFF">:</font></td>
<td class="p1" width="11"><img src="img/bule2.gif" width="11" height="18"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td class=p2 align="left" >
<p><br>
</p>
<p><b><font color="#CC0000"> 看看什麽东西在跟着你的鼠标?</font></b> </p>
</td>
<td bgcolor="5F74BF" width="28" align="center"> </td>
<td width="37" align="center"> </td>
</tr>
<tr>
<td align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="15"> </td>
</tr>
<tr align="center">
<td>
<table width="110" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="5F74BF" align="center">
<td class="p1" align="right"><b><font color="#FFFFFF">源代码如下</font></b><font color="#FFFFFF">:</font></td>
<td class="p1" width="11"><img src="img/bule2.gif" width="11" height="18"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="457" class="p2" valign="top"><b><br>
<br>
</b><span class="p1"><font color="#6633FF"> </font></span><b><br>
</b>
<form>
<p><span class="p1"><font color="#6633FF">这段程序放在<body>与</body>之间</font></span>
<textarea name="textarea3" onFocus="this.select()" onMouseOver="this.focus()" cols="50" rows="15" wrap="VIRTUAL" style="BACKGROUND-COLOR: #D5E9FD;" ><script language="JavaScript">
var newtop=0
var newleft=0
if (navigator.appVersion.indexOf("MSIE") != -1) {
layerStyleRef="layer.style.";
layerRef="document.all";
styleSwitch=".style";
}
function doMouseMove() {
layerName = 'iit'
eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')
eval('curElement'+styleSwitch+'.visibility="visible"')
eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')
eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')
eval('height=curElement'+styleSwitch+'.height')
eval('width=curElement'+styleSwitch+'.width')
width=parseInt(width)
height=parseInt(height)
if (event.clientX > (document.body.clientWidth - 5 - width))
{
newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width
}
else
{
newleft=document.body.scrollLeft + event.clientX
}
eval('curElement'+styleSwitch+'.pixelLeft=newleft')
if (event.clientY > (document.body.clientHeight - 5 - height))
{
newtop=document.body.clientHeight + document.body.scrollTop - 5 - height
}
else
{
newtop=document.body.scrollTop + event.clientY
}
eval('curElement'+styleSwitch+'.pixelTop=newtop')
}
document.onmousemove = doMouseMove;
</script>
<script language="javascript">
if (navigator.appVersion.indexOf("MSIE") != -1) {
document.write('<div ID=OuterDiv>')
document.write('<img ID=iit src="img/rabbit.gif" STYLE="position:absolute;TOP:0pt;LEFT:0pt;Z-INDEX:2;visibility:hidden;">')
document.write('</div>')
}
</script></textarea>
</p>
</form>
<b> </b></td>
<td bgcolor="5F74BF" width="28" align="center"> </td>
<td width="37" align="center"> </td>
</tr>
<tr>
<td align="center" valign="bottom" height="36">
<table width="238" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td> </td>
</tr>
</table>
</td>
<td width="457" class="p2" valign="top" height="36"> </td>
<td bgcolor="5F74BF" width="28" align="center" height="36"><img src="img/bule1.gif" width="28" height="49"></td>
<td width="37" align="center" height="36"> </td>
</tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class="p2" align="right" width="693"> <br>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="p1"><font color="#6633FF">注:此效果只能在IE浏览器中实现,本例中所用的图形放在与本页面同级的“img”文件夹内,名为rabbit.gif。</font></span>
</td>
</tr>
</table>
<br>
<br>
</td>
<td class="p2" width="18"> </td>
<td class="p2" width="1" bgcolor="A8A8AB"><img src="img/blank.gif" width="1" height="1"></td>
<td class="p2" width="48"> </td>
</tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<tr bgcolor="5F74BF">
<td> </td>
</tr>
</table>
<p> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -