6、升降的文字
类别: JavaScript教程
====1、以下代码放在HTML的<body></body>之间[适当的位置]:
<script language="JavaScript">
<!--
done = 0;
step = 4
function anim(yp,yk)
{
if(document.layers) document.layers["napis"].top=yp;
else document.all["napis"].style.top=yp;
if(yp>yk) step = -4
if(yp<60) step = 4
setTimeout(\'anim(\'+(yp+step)+\',\'+yk+\')\', 35);
}
function start()
{
if(done) return
done = 1;
if(navigator.appName=="Netscape") {
document.napis.left=innerWidth/2 - 145;
anim(60,innerHeight - 60)
}
else {
napis.style.left=11;
anim(60,document.body.offsetHeight - 60)
}
}
//-->
</script>
<div id="napis" style="position: absolute;top: -50;color: #000000;font-family:宋体;font-size:9pt;">
<p>
我是姜猛!
</p></div>
<script language="JavaScript">
<!--
setTimeout(\'start()\',10);
//-->
</script>
<script language="JavaScript">
<!--
done = 0;
step = 4
function anim(yp,yk)
{
if(document.layers) document.layers["napis"].top=yp;
else document.all["napis"].style.top=yp;
if(yp>yk) step = -4
if(yp<60) step = 4
setTimeout(\'anim(\'+(yp+step)+\',\'+yk+\')\', 35);
}
function start()
{
if(done) return
done = 1;
if(navigator.appName=="Netscape") {
document.napis.left=innerWidth/2 - 145;
anim(60,innerHeight - 60)
}
else {
napis.style.left=11;
anim(60,document.body.offsetHeight - 60)
}
}
//-->
</script>
<div id="napis" style="position: absolute;top: -50;color: #000000;font-family:宋体;font-size:9pt;">
<p>
我是姜猛!
</p></div>
<script language="JavaScript">
<!--
setTimeout(\'start()\',10);
//-->
</script>
-= 资 源 教 程 =-
文 章 搜 索