onerror 事件 !DOCTYPE htmlhtmlhead meta charset="utf-8" title滴答编程(dida100.com)/title scriptonerror=handleErr;var txt="";function handleErr(msg,url,l){txt="该页面有一个错误\n\n";txt+="错误: " + msg + "\n";txt+="URL: " + u...
...
创建一个欢迎 cookie !DOCTYPE htmlhtmlheadmeta charset="utf-8"title滴答编程(dida100.com)/title/headheadscriptfunction setCookie(cname,cvalue,exdays){var d = new Date();d.setTime(d.getTime()+(exdays*24*60*60*1000));var expires = "ex...
简单的计时 !DOCTYPE htmlhtmlheadmeta charset="utf-8"title滴答编程(dida100.com)/title/headbodyp点击按钮,在等待 3 秒后弹出 "Hello"。/pbutton onclick="myFunction()"点我/buttonscriptfunction myFunction(){setTimeout(func...
另一个简单的计时 !DOCTYPE htmlhtmlheadmeta charset="utf-8"title滴答编程(dida100.com)/title/headheadscriptfunction timedText(){var x=document.getElementById('txt');var t1=setTimeout(function(){x.value="2 秒"},2000);var t2=setTim...
在一个无穷循环中的计时事件 !DOCTYPE htmlhtmlhead meta charset="utf-8" title滴答编程(dida100.com)/title scriptvar c=0;var t;var timer_is_on=0;function timedCount(){document.getElementById('txt').value=c;c=c+1;t=setTimeout("t...
带有停止按钮的无穷循环中的计时事件 !DOCTYPE htmlhtmlhead meta charset="utf-8" title滴答编程(dida100.com)/title scriptvar c=0;var t;var timer_is_on=0;function timedCount(){document.getElementById('txt').value=c;c=c+1;t=s...
使用计时事件制作的钟表 !DOCTYPE htmlhtmlheadmeta charset="utf-8"title滴答编程(dida100.com)/titlescriptfunction startTime(){var today=new Date();var h=today.getHours();var m=today.getMinutes();var s=today.getSeconds();// 在小于...
创建对象的实例 !DOCTYPE htmlhtmlheadmeta charset="utf-8"title滴答编程(dida100.com)/title/headbodyscriptperson={firstname:"John",lastname:"Doe",age:50,eyecolor:"blue"}document.write(person.firstname + " is " + person.age + " years...
创建用于对象的模板 !DOCTYPE htmlhtmlheadmeta charset="utf-8"title滴答编程(dida100.com)/title/headbodyscriptfunction person(firstname,lastname,age,eyecolor){this.firstname=firstname;this.lastname=lastname;this.age=age; this.eyec...