码迷,mamicode.com
首页 > 编程语言 > 详细

Python基础第27天

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

标签:set   button   click   alt   一段   value   rip   span   警告   

一: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天

标签:set   button   click   alt   一段   value   rip   span   警告   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!