javascript BOM对象 第15节
<html>
<head>
<title>浏览器对象</title>
<script type="text/javascript">
var a = 20;//声明变量 函数 对象 属于window对象
//alert(window.a);
function test () {
alert("window对象函数");
}
//window.test();//函数调用
</script>
</head>
<body>
<div>BOM对象</div>
1.navigator<br/>
<script type="text/javascript">
for ( var name in navigator )
{
document.write(name ," : " ,navigator[name], "<br/>");
}
</script>
2.screen<br/>
<script type="text/javascript">
for ( var name in screen )
{
document.write(name ," : " , screen[name], "<br/>");
}
</script>
3.history<br/>
<script type="text/javascript">
</script>
<a href="浏览器对象.htm" target="_self">浏览器对象</a>
<input type="button" value="向前" onclick="history.forward()"/><br/>
4.location<br/>
<script type="text/javascript">
document.write("location.host : ", location.host, "<br/>");
document.write("随机数 : ", Math.round(Math.random() * 100), "<br/>");
</script>
<input type="button" value="换页1" onclick="location.href='浏览器对象.htm'"/>
<input type="button" value="换页2" onclick="location='浏览器对象.htm'"/>
<input type="button" value="刷新" onclick="location.reload()"/>
<input type="button" value="替换" onclick="location.replace('内置对象.htm')"/>
<input type="button" value="转向" onclick="location.assign('内置对象.htm')"/>
</body>
</html>
rs:

2.

浙公网安备 33010602011771号