為什么在a標簽內加入javasprite再去調用函數(shù),是固定寫法嗎。
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫好網(wǎng)頁布局-->
? <h1>操作成功</h1>
<span id="second" >5</span>
? <span >秒后回到主頁</span>
? <a href="javascript:back();">返回</a>
??
??
?
? <script type="text/javascript"> ?
? ? var num=document.getElementById("second").innerHTML;
? ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
??
? ? function count()
? ? {
? ? ? ? num--;
? ? ? ? document.getElementById("second").innerHTML=num;
? ? ? ? if(num==1)
? ? ? ? {
? ? ? ? ? ?window.location.assign("http://yifanck.cn");
? ? ? ? }
? ? }
? ? setInterval("count()",1000);
? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉。
? ? function back()
? ? {
? ? ? ?window.history.back();
? ?}
? ?
?</script>?
</body>
</html>
2017-01-22
樓上已經(jīng)說過了,這不是固定寫法。就我知道的a標簽點擊事件的寫法就是:a href="JavaScript:method();" 或者 a href="#" onclick="method()"
2017-01-15
這是在a標簽有點擊事件,可以有多種寫法