一、【文件(F)】菜单中的命令的实现
1、〖打开〗命令的实现
document.execCommand("open")
这跟VB等编程设计中的webbrowser控件中的命令有些相似
<a href="#" οnclick=document.execCommand("open")>打开</a>
2、〖使用 记事本 编辑〗命令的实现
location.replace("view-source:"+location)
打开记事本,在记事本中显示该网页的源代码
<a href="#" οnclick=location.replace("view-source:"+location)>使用记事本编辑</a>
3、〖另存为〗命令的实现
document.execCommand("saveAs")
将该网页保存到本地盘的其它目录
<a href="#" οnclick=document.execCommand("saveAs")>另存为</a>
4、〖打印〗命令的实现
document.execCommand("print")
当然,你必须装了打印机
<a href="#" οnclick=document.execCommand("print")>打印</a>
5、〖关闭〗命令的实现
window.close();return false
将关闭本窗口
<a href="#" οnclick=window.close();return false)>关闭本窗口</a>
二、【编辑(E)】菜单中的命令的实现
〖全选〗命令的实现
document.execCommand("selectAll")
将选中网页中的全部内容
<a href="#" οnclick=document.execCommand("selectAll")>全选</a>
三、【查看(V)】菜单中的命令的实现
1、〖刷新〗命令的实现
location.reload() 或 history.go(0)
浏览器重新打开本页
<a href="#" οnclick=location.reload()>刷新</a>
<a href="#" οnclick=history.go(0)>刷新</a>
2、〖源文件〗命令的实现
location.replace("view-source:"+location)
查看该网页的源代码
<a href="#" οnclick=location.replace("view-source:"+location)>查看源文件</a>
3、〖全屏显示〗命令的实现
window.open(document.location,"url","fullscreen")
全屏显示本页
<a href="#" οnclick=window.open(document.location,"url","fullscreen")>全屏显示</a>
四、【收藏(A)】菜单中的命令的实现
1、〖添加到收藏夹〗命令的实现
window.external.AddFavorite("url", "“网站名”)
将本页添加到收藏夹
<a href="java script:window.external.AddFavorite("http://www.baidu.com", "百度")">添加到收藏夹</a>
2、〖整理收藏夹〗命令的实现
window.external.showBrowserUI("OrganizeFavorites",null)
打开整理收藏夹对话框
<a href="#" οnclick=window.external.showBrowserUI("OrganizeFavorites",null)>整理收藏夹</a>
五、【工具(T)】菜单中的命令的实现
〖internet选项〗命令的实现
window.external.showBrowserUI("PrivacySettings",null)
打开internet选项对话框
<a href="#" οnclick=window.external.showBrowserUI("PrivacySettings",null)>internet选项</a>
六、【工具栏】中的命令的实现
1、〖前进〗命令的实现
history.go(1) 或 history.forward()
浏览器打开后一个页面
<a href="#" οnclick=history.go(1)>前进</a>
<a href="#" οnclick=history.forward()>前进</a>
2、〖后退〗命令的实现
history.go(-1) 或 history.back()
浏览器返回上一个已浏览的页面
<a href="#" οnclick=history.go(-1)>后退</a>
<a href="#" οnclick=history.back()>后退</a>
3、〖刷新〗命令的实现
document.reload() 或 history.go(0)
浏览器重新打开本页
<a href="#" οnclick=location.reload()>刷新</a>
<a href="#" οnclick=history.go(0)>刷新</a>
七、其它命令的实现
〖定时关闭本窗口〗命令的实现
settimeout(window.close(),关闭的时间)
将关闭本窗口
<a href="#" οnclick=settimeout(window.close(),3000)>3秒关闭本窗口</a>
转自:http://blog.csdn.net/crl_lxy/archive/2008/07/25/2711125.aspx