JavaScript
function tan(){
alert("HELLO")
}
html
<input type=button value=按钮 onclick=tan() />
<!DOCTYPE html><html>
<head>
<meta charset="UTF-8">
<title>主标题 | 副标题</title>
</head>
<body>
<p>hello world</p>
</body>
</html>
把下边代码放进一个记事本里,保存成后缀为.html的文件就可以看到效果了
<div id="content" style="font-family:'Times New Roman'">Hello World<br /></div><script type="text/javascript">
var thisTimmer = setInterval(startHello,1000)
setTimeout(stopHello, 10000)
function startHello() {
var content = document.getElementById("content").innerHTML
document.getElementById("content").innerHTML = content + "Hello World<br />"
}
function stopHello() {
clearInterval(thisTimmer)
}
</script>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)