摘要:
清华大学出版的《事半功倍系列 javascript》,本人照着书敲出来的,有些翻译了一下.前几年看了一下,最近无事,重新翻了翻,很有帮助.本书应该有光盘的,但学校的书,光盘不知在哪.希望对你学 javascript有帮助关键字:
Javascript学习 js 正文:
document.write("hostname"+location.hostname+"<br>")
document.write("host"+location.host+"<br>")
document.write("href"+location.href+"<br>")
document.write("port"+location.port+"<br>")
document.write("search"+location.search+"<br>")
</script>
重新加载网页
<form name=form1>
<input type=button name=button1 value=重新加载本页 onclick=location.reload>
</form>
5.使用cookie
<script>
finction makecookie(){
if(!document.cookie){
name=prompt("请输入你的姓名");
document.cookie="name="+name+";";}
}
</script>
<body onload=makecookie()>
<script>
function makecookie(){
if(!document.cookie){
name=prompt("请输入你的姓名")
document.cookie="name="+name+";";
namestart=document.cookie.indexOf("=");
nameend=document.cookieindexOf(";");
document.writeln("your name is:"+document.cookie.substring(namestart+1,nameend)+",br>")
}
}
</script>
[1][2][3][4][5][6][7][8]