hah運行不出來,哈哈
1、<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫好網頁布局-->
? <p>操作成功</p>
? <p id="p1" style="float:left;">5</p>
? <p style="float:left;">秒后回到主頁</p>?
? <script type="text/javascript"> ?
?
?function start(){
? ? ?num = num - 1;
? ? ?document.geyElementById("p1").innerHTML=num;
? ?if (atima==0)
? ?{
? ? ? ?window.open("http://www.imooc.con","_black","width=200 height=300");
? ?}
?}?
?var p1 = setTime("start()",1000);
? ?//獲取顯示秒數的元素,通過定時器來更改秒數。
function fanhui()
{
? ? window.history.back();
}
? ?//通過window的location和history對象來控制網頁的跳轉。
?</script> ??
?<form>
? ? ?<input ?type="button" value="返回" onclick="fanhui"/>
?</form>
</body>
</html>
2、location.assign("www.xianlaiwan.cn");什么意思,怎么用的,在前面學過嗎?
3、document.getElementById("second").innerHTML=num; ?和
document.getElementById("second").value=num;不一樣嗎,
2018-06-18
第一:?document.geyElementById("p1").innerHTML=num; 單詞寫錯
if (atima==0)? atima哪來的變量, setInterval();不是setTime,setTime()不是定時器方法,
onclick那里調用方法不加括號()
第二:location.assign("www.xianlaiwan.cn");什么意思,怎么用的,在前面學過嗎?這個是加載新的文檔,當你調用這個方法就會加載新文檔|頁面
第三:innerHTML和value是不一樣的,innerHTML是標簽的內容,而value是標簽的值,例如input標簽,它就是獲取value而不是innerHTML,value一般用來獲取input標簽的值,其它大部分都可以用innerHTML來獲取內容