14個經典的JavaScript代碼

來源:互聯網
上載者:User

重新整理
<input id="bn6" type="button" onclick="window.location.reload()" value="重新整理" />

匯入收藏夾
<input id="bn7" type="button" onclick="window.external.ImportExportFavorites(true,'http://aidd2008.cnblogs.com');" value="匯入收藏夾" />

匯出收藏夾
<input id="bn8" type="button" onclick="window.external.ImportExportFavorites(false,'http://aidd2008.cnblogs.com');" value="匯出收藏夾" />

加入收藏夾
<input id="bn9" type="button" onclick="window.external.AddFavorite(location.href, document.title)" value="加入收藏夾" />

整理收藏夾
<input id="bn10" type="button" onclick="window.external.ShowBrowserUI(OrganizeFavorites, null)" value="整理收藏夾" />

查看源檔案 ff可行ie不可行
<input id="bn1" type="button" onclick="window.location = 'view-source:' + window.location.href" value="查看源檔案" />

語言設定
<input id="bn12" type="button" onclick="window.external.ShowBrowserUI(LanguageDialog, null)" value="語言設定" />

前進
<input id="bn13" type="submit" onclick="history.go(1)" value="前進" />

後退
<input id="bn14" type="submit" onclick="history.go(-1)" value="後退" />

開啟
<input id="bn1" type="button" onclick="document.all.WebBrowser.ExecWB(1,1)" value="開啟" /> 

另存新檔
<input id="bn2" type="button" onclick="document.all.WebBrowser.ExecWB(4,1)" value="另存新檔" />

列印
<input id="bn3" type="button" onclick="document.all.WebBrowser.ExecWB(6,1)" value="列印"/>

版面設定
<input id="bn4" type="button" onclick="document.all.WebBrowser.ExecWB(8,1)" value="版面設定" />

屬性
<input id="bn5" type="button" onclick="document.all.WebBrowser.ExecWB(10,1)" value="屬性" />

<object id="WebBrowser" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0" width="0" />

WebBrowser.ExecWB(1,1) 開啟
WebBrowser.ExecWB(2,1) 關閉現在所有的IE視窗,並開啟一個新視窗
WebBrowser.ExecWB(4,1) 儲存網頁
WebBrowser.ExecWB(6,1) 列印
WebBrowser.ExecWB(7,1) 預覽列印
WebBrowser.ExecWB(8,1) 列印版面設定
WebBrowser.ExecWB(10,1) 查看頁面屬性
WebBrowser.ExecWB(15,1) 好像是撤銷,有待確認
WebBrowser.ExecWB(17,1) 全選
WebBrowser.ExecWB(22,1) 重新整理
WebBrowser.ExecWB(45,1) 關閉表單無提示
這些只對IE5.5以上版本有效,對其他瀏覽器的相容性不是很好!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.