通過了解下面的一些例子,并運用到你的WEB中,不久你馬上成為JAVASCIPT的高手。 < script language='JavaScript' > < script language='JavaScript' > (2)在BODY標簽中: 通過以上兩步即可完成。 例(四)、提供前進、后退功能 例(五)、在頁面加入文檔最后修改日期 例(七)、提供前進、后退功能 < H3 onclick='history.go(-1)' > 前一頁< /H3> 例(八)、獲得瀏覽器的屬性
例(一)、在頁面加入當前時間
tdy=new Date();
document.write('當前時間:',tdy.getHours());
document.write(':',tdy.getMinutes());
document.write(':',tdy.getSeconds());
例(二)、在頁面加入文檔最后修改日期
document.write('本頁最后編輯日期:');
document.write(document.lastModified)
例(三)、在窗口的狀態提示窗顯示移動信息
(1) 在BODY之前
< script language='JavaScript' >
var msg='這是一個狀態行滾動顯示的JAVASCIPT程序,有興趣的同志,可以粘貼!';
var i=1
function scroll()
{
mess=msg.substring(i,msg.length)+' '+msg.substring(0,i)
window.status=mess
i++;
if (i>=msg.length) i=1;
setTimeout('scroll()',200);
}
< form >
< input type='button' value='<-'
onclick='history.go(-1) >
< input type='button' value='->'
onclick='history.go(1) >
< /form >
< script language='JavaScript' >
document.write('本頁最后編輯日期:');
document.write(document.lastModified)
例(六)、鼠標移到時發生動作
< A HREF='MAILTO:ZZY71616@163.NET'
onmouseover='alert('寫信給我');
return true' > 信箱< /A >
< H3 onclick='history.go(-2)' > 前兩頁< /H3>
< H3 onclick='history.go(-3)' > 前三頁< /H3>
< H3 onclick='history.go(1)' > 后一頁< /H3>
< H3 onclick='history.go(2)' > 后兩頁< /H3>
< H3 onclick='history.go(3)' > 后三頁< /H3>
navigator.appCodename=undefinednavigator.appName=Microsoft Internet Explorernavigator.appVersion=4.0 (compatible; MSIE 5.0; Windows 98; DigExt)navigator.appAgent=undefined