文字在网页上下浮动 学习可以不建议用
作者:bea
<html> <head> <title>上下跳动的文本</title> </head> <body> <script language="JavaScript"> <!-- done = 0; step = 4 function anim(yp,yk) { if(document.layers) document.layers["napis"].top=yp; else docume
<html>
<head>
<title>上下跳动的文本</title>
</head>
<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+')', 10);
}
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=280;
anim(60,document.body.offsetHeight - 60)
}
}
//-->
</script>
<div id="napis"
style="position: absolute; top: 159px; width: 400px; height: 78px; left: 215px"><font size="5">
<font face="华文行楷"><b>
</b></div>
<script language="JavaScript">
<!--
setTimeout('start()',10);
//-->
</script>
</body>
</html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行]
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- JS获取dom 对象 ajax操作 读写cookie函数
- jquery中的$(document).ready()与window.onload的区别
- jQuery html()等方法介绍
- JQuery toggle使用分析
- JavaScript 读取图片实例代码
- javascript 随机抽奖程序代码
- javascript 图片放大效果函数
- JavaScript OOP类与继承
- JavaScript的eval JSON object问题
- Javascript 中文字符串处理额外注意事项
- Dojo 学习笔记入门篇 First Dojo Example
- flash 得到自身url参数的代码
- javascript 去字符串空格终极版(支持utf8)
- jQuery checkbox全选/取消全选实现代码
- jQuery帮助之CSS尺寸(五)outerHeight、outerWidth
- jquery 可排列的表实现代码
- javascript 带有滚动条的表格,标题固定,带排序功能.
- 传智播客学习之JavaScript基础篇
- [原创]一段时间以后切换显示的广告代码