jQuery对象和Dom对象

来源:互联网 发布:大龄软件工程硕士 编辑:程序博客网 时间:2024/05/17 02:31

//Window对象

属性:document/location/parent

方法:

setTimeout(“code”,毫秒)
让这个1秒后再显示

var i=0;function test(){    i+=1;    alert(i);}setTimeout("test()",1000); 
//Document 对象
getElementById()
getElementsByTagName()
write()

练习:弹出提示框:提示“ok

html代码

<input type="button"value="按钮" onclick="mybutton()">点击按钮3秒后,显示提示框</input>
js代码
function mybutton(){var r =confirm("按下按钮");    if(r==true)    {        document.write("你按下了确认键");    }else{        document.write("你按下了取消键键");    }}练习

弹出提示框:显示110的累加结果

  var num=0;  for(var i=1;i<=10;i++){      num+=i;  }alert(num);
练习:

编写页面,登录学校系统。

检查用户名、密码是否为空,如果为空,给出提示。

如果不为空,提交登录。

下次给答案
//======================================
练习:

编写页面,实现倒计时功能。

要求:

一个开始按钮、一个停止按钮、一个显示时间

(分:秒  格式)


0 0
原创粉丝点击