<html> |
<head> |
<title>使用location对象</title> |
</head> |
<body> |
使用location对象设置新链接窗口的路径:<br> |
<form> |
<Input type= "button" Value= "打开新的页面" onClick= "window.location.href='exam.html';" > |
</form> |
<br> |
<br> |
下面返回本页面地址的协议和路径名<br> |
<br> |
<Script Language= "JavaScript" > |
<!-- |
document.write( "本页地址的协议是:" ); |
document.write(location.protocol); |
document.write( "<br>本页面地址的路径名是:" ); |
document.write(location.pathname); |
--> |
</script> |
</body> |
</html> |