定时器轮寻
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="a"> 北京欢迎您,为你开天辟地</div>
<script>
function func() {
//z 根据Id获取标签的内容
var tag = document.getElementById('a');
var content = tag.innerText;
//获得标签内部的内容
var f = content.charAt(0);
var l = content.substring(1, content.length); var new_content = l+f;
tag.innerText = new_content;
}
//设置定时器
setInterval('func()', 500);
</script>
</body>
</html>
定时器轮寻
弹出框
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<!--定义一下我是什么语言-->
<title>Title</title> </head>
<body>
<input type="text"/>
<input id="user" type="button" value="点我" onclick="dianji()"/>
<script >
function dianji() {
var i=document.getElementById('user')
alert(i.value)
}
</script>
</body>
</html>
弹出框
跑马灯
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Title</title>
</head>
<body>
<h1 id ='res'>有没有那么一首歌,会让我突然想起你</h1>
<script>
function f1() {
var i=document.getElementById('res');
var content=i.innerText;
var f=content.charAt(0);
var d=content.substring(1,content.length);
var new_content=d+f;
i.innerText=new_content;
}
setInterval('f1()',500)
</script> </body>
</html>
跑马灯