首页 > 编程语言 > 详细

Python基础第27天

时间:2017-04-09 23:08:35      阅读:240      评论:0      收藏:0      [点我收藏+]

一:BOM对象(浏览器对象模型,可以对浏览器进行访问和操作)

Window 对象方法

alert()            显示带有一段消息和一个确认按钮的警告框。
confirm()          显示带有一段消息以及确认按钮和取消按钮的对话框。
prompt()           显示可提示用户输入的对话框。

open()             打开一个新的浏览器窗口或查找一个已命名的窗口。
close()            关闭浏览器窗口。
setInterval()      按照指定的周期(以毫秒计)来调用函数或计算表达式。
clearInterval()    取消由 setInterval() 设置的 timeout。
setTimeout()       在指定的毫秒数后调用函数或计算表达式。
clearTimeout()     取消由 setTimeout() 方法设置的 timeout。
scrollTo()         把内容滚动到指定的坐标。

setInterval clearInterval

<!--setInterval()      按照指定的周期(以毫秒计)来调用函数或计算表达式。-->
<!--clearInterval()    取消由 setInterval() 设置的 timeout。-->
<input type="text" id="id1" onclick="begin()" >
<button onclick="end()">停止</button>

<script>

    function showTime() {
        var current_time=new Date().toLocaleString();
        var ele=document.getElementById(‘id1‘);
        ele.value=current_time
    }
    var clock1;
    function begin() {
        if(clock1==undefined){
            showTime();
            clock1=setInterval(showTime,1000)
        }
    }
    function end() {
        clearInterval(clock1);
        clock1=undefined;
    }



</script>

setTimeout clearTimeout   在指定的毫秒数后调用函数或计算表达式

技术分享
var ID = setTimeout(abc,2000); // 只调用一次对应函数.
            clearTimeout(ID);
    function abc(){
        alert(‘aaa‘);
    }
View Code

History 对象

back()    加载 history 列表中的前一个 URL。
forward()    加载 history 列表中的下一个 URL。
go()    加载 history 列表中的某个具体页面
<a href="rrr.html">click</a>
<button onclick=" history.forward()">>>></button>
<button onclick="history.back()">back</button>
<button onclick="history.go()">back</button>

 

Python基础第27天

原文:http://www.cnblogs.com/xyd134/p/6686974.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!