<li>* 除可以检测用户浏览器的相关信息之外,还可以对用户浏览器进行一定的控制。使用Window对象可以控制用户浏览器窗口的外观。例如,可以使用 window.scrollTo( )或window.resizeTo( )滚动窗口,或者改变其大小,还可以使用window.status( )或 window.defaultStatus( )改变浏览器的状态栏信息。
<li>* Netscape和Opera支持大量模拟浏览器活动的方法,例如单击按钮。IE则不支持众多类似的方法,然而对于IE用户,至少可以使用对象检测技术进行模拟,而不致使程序报错。
<li>* Window对象的print( )方法、forward( )方法、back( )方法、home( )方法、stop( )方法,分别对应浏览器菜单中的打印、前进、后退、默认主页、停止等功能。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>模拟浏览器菜单</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#ffc0c0">
<h1 align="center">模拟浏览器菜单</h1><hr>
<!--控制表单-->
<form action="#" method="get">
<table border="1" bordercolor="green" cellspacing="5" cellpadding="5"><tr><td>
<!--设置不同的表单,分别通过onclick调用相应的函数,完成不同的事件模拟-->
<input type="button" value="打印"
οnclick=" if (window.print) window.print();">
</td><td>
<input type="button" value="前进"
οnclick="if (window.forward) window.forward();">
</td><td>
<input type="button" value="后退"
οnclick="if (window.back) window.back();">
</td><td>
<input type="button" value="主页"
οnclick="if (window.home) window.home();">
</td><td>
<input type="button" value="停止"
οnclick="if (window.stop) window.stop();">
</td></tr></table>
</form>
</body>
</html>
<li>* Netscape和Opera支持大量模拟浏览器活动的方法,例如单击按钮。IE则不支持众多类似的方法,然而对于IE用户,至少可以使用对象检测技术进行模拟,而不致使程序报错。
<li>* Window对象的print( )方法、forward( )方法、back( )方法、home( )方法、stop( )方法,分别对应浏览器菜单中的打印、前进、后退、默认主页、停止等功能。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>模拟浏览器菜单</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#ffc0c0">
<h1 align="center">模拟浏览器菜单</h1><hr>
<!--控制表单-->
<form action="#" method="get">
<table border="1" bordercolor="green" cellspacing="5" cellpadding="5"><tr><td>
<!--设置不同的表单,分别通过onclick调用相应的函数,完成不同的事件模拟-->
<input type="button" value="打印"
οnclick=" if (window.print) window.print();">
</td><td>
<input type="button" value="前进"
οnclick="if (window.forward) window.forward();">
</td><td>
<input type="button" value="后退"
οnclick="if (window.back) window.back();">
</td><td>
<input type="button" value="主页"
οnclick="if (window.home) window.home();">
</td><td>
<input type="button" value="停止"
οnclick="if (window.stop) window.stop();">
</td></tr></table>
</form>
</body>
</html>