最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

JS實(shí)現(xiàn)瀏覽器菜單命令

 更新時(shí)間:2006年09月05日 00:00:00   作者:  
序:用js實(shí)現(xiàn)菜單命令雖然在技術(shù)上講沒什么,不過這個(gè)算是比較全了。

     每當(dāng)我們看到別人網(wǎng)頁(yè)上的打開、打印、前進(jìn)、另存為、后退、關(guān)閉本窗口、禁用右鍵等實(shí)現(xiàn)瀏覽器命令的鏈接,而自己苦于不能實(shí)現(xiàn)時(shí),是不是感到很遺憾?是不是也想實(shí)現(xiàn)?如果能在網(wǎng)頁(yè)上能實(shí)現(xiàn)瀏覽器的命令,將是多么有意思的事?。∠旅嫖覀兙蛠砜纯慈绾斡肑avascript代碼實(shí)現(xiàn)瀏覽器菜單命令(以下代碼在Windows XP下的瀏覽器中調(diào)試通過)。

一、【文件(F)】菜單中的命令的實(shí)現(xiàn)

  1、〖打開〗命令的實(shí)現(xiàn)

  [格式]:document.execCommand("open")
  [說明]這跟VB等編程設(shè)計(jì)中的webbrowser控件中的命令有些相似,大家也可依此琢磨琢磨。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=document.execCommand("open")>打開</a>

  2、〖使用 記事本 編輯〗命令的實(shí)現(xiàn) 

  [格式]:location.replace("view-source:"+location)
  [說明]打開記事本,在記事本中顯示該網(wǎng)頁(yè)的源代碼。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=location.replace("view-source:"+location)>使用 記事本 編輯</a>

  3、〖另存為〗命令的實(shí)現(xiàn) 

  [格式]:document.execCommand("saveAs")
  [說明]將該網(wǎng)頁(yè)保存到本地盤的其它目錄!
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=document.execCommand("saveAs")>另存為</a>

  4、〖打印〗命令的實(shí)現(xiàn) 

  [格式]:document.execCommand("print")
  [說明]當(dāng)然,你必須裝了打印機(jī)!
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=document.execCommand("print")>打印</a>

  5、〖關(guān)閉〗命令的實(shí)現(xiàn) 

  [格式]:window.close();return false
  [說明]將關(guān)閉本窗口。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=window.close();return false)>關(guān)閉本窗口</a>


二、【編輯(E)】菜單中的命令的實(shí)現(xiàn)

  〖全選〗命令的實(shí)現(xiàn) 
  [格式]:document.execCommand("selectAll")
  [說明]將選種網(wǎng)頁(yè)中的全部?jī)?nèi)容!
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=document.execCommand("selectAll")>全選</a>

三、【查看(V)】菜單中的命令的實(shí)現(xiàn)

  1、〖刷新〗命令的實(shí)現(xiàn) 

  [格式]:location.reload() 或 history.go(0)
  [說明]瀏覽器重新打開本頁(yè)。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=location.reload()>刷新</a>
  或加入:<a href="#" onclick=history.go(0)>刷新</a> 

  2、〖源文件〗命令的實(shí)現(xiàn) 

  [格式]:location.replace("view-source:"+location)
  [說明]查看該網(wǎng)頁(yè)的源代碼。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=location.replace("view-source:"+location)>查看源文件</a>


  3、〖全屏顯示〗命令的實(shí)現(xiàn) 

  [格式]:window.open(document.location,"url","fullscreen")
  [說明]全屏顯示本頁(yè)。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=window.open(document.location,"url","fullscreen")>全屏顯示</a>


四、【收藏(A)】菜單中的命令的實(shí)現(xiàn)

  1、〖添加到收藏夾〗命令的實(shí)現(xiàn) 

  [格式]:window.external.AddFavorite('url', '“網(wǎng)站名”)
  [說明]將本頁(yè)添加到收藏夾。
  [舉例]在<body></body>之間加入:
  <a href="javascript:window.external.AddFavorite('http://oh.jilinfarm.com', '胡明新的個(gè)人主頁(yè)')">添加到收藏夾</a> 

  2、〖整理收藏夾〗命令的實(shí)現(xiàn) 

  [格式]:window.external.showBrowserUI("OrganizeFavorites",null)
  [說明]打開整理收藏夾對(duì)話框。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=window.external.showBrowserUI("OrganizeFavorites",null)>整理收藏夾</a> 

五、【工具(T)】菜單中的命令的實(shí)現(xiàn)

  〖internet選項(xiàng)〗命令的實(shí)現(xiàn) 

  [格式]:window.external.showBrowserUI("PrivacySettings",null)
  [說明]打開internet選項(xiàng)對(duì)話框。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=window.external.showBrowserUI("PrivacySettings",null)>internet選項(xiàng)</a> 


六、【工具欄】中的命令的實(shí)現(xiàn)

  1、〖前進(jìn)〗命令的實(shí)現(xiàn) 

  [格式]history.go(1) 或 history.forward()
  [說明]瀏覽器打開后一個(gè)頁(yè)面。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=history.go(1)>前進(jìn)</a>
  或加入:<a href="#" onclick=history.forward()>前進(jìn)</a>

  2、〖后退〗命令的實(shí)現(xiàn) 

  [格式]:history.go(-1) 或 history.back()
  [說明]瀏覽器返回上一個(gè)已瀏覽的頁(yè)面。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=history.go(-1)>后退</a>
  或加入:<a href="#" onclick=history.back()>后退</a>

  3、〖刷新〗命令的實(shí)現(xiàn) 

  [格式]:document.reload() 或 history.go(0)
  [說明]瀏覽器重新打開本頁(yè)。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=location.reload()>刷新</a>
  或加入:<a href="#" onclick=history.go(0)>刷新</a> 

七、其它命令的實(shí)現(xiàn) 

  〖定時(shí)關(guān)閉本窗口〗命令的實(shí)現(xiàn) 
  [格式]:settimeout(window.close(),關(guān)閉的時(shí)間)
  [說明]將關(guān)閉本窗口。
  [舉例]在<body></body>之間加入:
  <a href="#" onclick=setTimeout(window.close(),3000)>3秒關(guān)閉本窗口</a>

相關(guān)文章

最新評(píng)論

兴义市| 黔东| 突泉县| 青州市| 米易县| 繁昌县| 民权县| 忻城县| 张家口市| 隆子县| 北流市| 阳东县| 水城县| 济南市| 吴川市| 荔浦县| 桐乡市| 夏邑县| 南召县| 睢宁县| 湖州市| 达拉特旗| 济源市| 华宁县| 澄城县| 台中县| 宣武区| 金门县| 南漳县| 双牌县| 益阳市| 乐亭县| 介休市| 丰原市| 栾城县| 水城县| 鹤岗市| 万荣县| 平谷区| 清水河县| 政和县|