模拟浏览器菜单

<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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值