····
<html>
<head>
<script>
/*
setTimeout 设置过期时间
setTimeout(时间到了之后要执行的行为,什么时间 毫秒 开始执行)
setInterval 设置中断时间
setInterval(时间到了之后要执行的行为 , 间隔多长时间再执行 )
*/
</html>
····
2:一闪一闪亮晶晶
····
html>
<head>
<style>
#container{
width: 400px
height: 400px
border: 1px solid yellowgreen
background-color: black
position: relative
}
</html>
····
3:定时跳转网页
····
<html>
<head>
<style>
#box{
width: 1300px
height: 100px
line-height: 100px
border: 1px solid black
color: yellowgreen
font: 29/30px "simsun"
text-align: center
}
</style>
</html>
····
4:弹窗
····
<html>
<head>
<script>
alert("我是弹窗")
window.alert("全写的窗口弹窗")
</html>
····
1、可以使用定时器setInteval()方法来实现不断刷新2、当点击按钮之后,执行方法利用clearInterval方法将定时器停止
代码如下:
$(function(){
var obj = setTimeout(定向的页面, 2000)// 每2秒刷新一次页面
$("#but_stop").click(function(){
clearInterval(obj)// 点击即停止刷新
})
})