window.external的使用

简介:window.external.AddFavorite这个把网站添加到浏览者收藏夹的脚本大家应该常常看过,但你还知道window.external的另外一些用法呢?由于是一些关于系统文件操作的命令,因为安全设置有些脚本会出错误.
1.external.AddDesktopComponent 把网站作为用户的Active桌面 
< language="JavaScript" type="text/javascript"> function j_adc(){ window.external.AddDesktopComponent("http://www.ie-zone.com","website",0,0,800,600); } 
语法:external.AddDesktopComponent(地址,类型[image/website],左距离,顶距离,宽度,长度)
function j_adc(){ //例子
window.external.AddDesktopComponent("http://www.ie-zone.com","website",0,0,800,600);
}

2.external.AddFavorite 把网站加入到用户的收藏夹 
< language="JavaScript" type="text/javascript"> function j_af(){ window.external.AddFavorite(location.href, document.title); } 
语法:external.AddFavorite(网址,标题);
function j_af(){
window.external.AddFavorite(location.href, document.title);
}

3.external.NavigateAndFind 搜索指定网站中的某个字段  
< language="JavaScript" type="text/javascript"> function j_an(){ window.external.NavigateAndFind("http://www.ie-zone.com/js/ref01101432.htm",gosearch.value,""); } 
语法:external.NavigateAndFind(文件地址,关键字,_Target)
<script language="JavaScript">
function j_an(){
window.external.NavigateAndFind("http://www.ie-zone.com/js/ref01101432.htm",gosearch.value,"");
}
</script>

4.external.ShowBrowserUI 调用语言选择窗口与收藏夹管理窗口  
< language="JavaScript" type="text/javascript"> function j_an(){ window.external.NavigateAndFind("http://www.ie-zone.com/js/ref01101432.htm",gosearch.value,""); } 
语法:external.ShowBrowserUI(类型[LanguageDialog/OrganizeFavorites], null)
<input type="button" name="Button" value="语言设置" onclick="window.external.ShowBrowserUI('LanguageDialog', null)">
<input type="button" name="Submit2" value="整理收藏夹" onclick="window.external.ShowBrowserUI('OrganizeFavorites', null)">

5.external.ImportExportFavorites 导入与导出用户收藏夹  
< language="JavaScript" type="text/javascript"> function j_an(){ window.external.NavigateAndFind("http://www.ie-zone.com/js/ref01101432.htm",gosearch.value,""); } 
语法:external.ImportExportFavorites(导入/true 导出/false, 文件路径)
<input type="button" name="Button" value="导入收藏夹" onClick=window.external.ImportExportFavorites(true,"http://www.ie-zone.com/ibook2.php");>
<input type="button" name="Button3" value="导出收藏夹" onClick=window.external.ImportExportFavorites(false,"http://www.ie-zone.com/ibook.php");>
 

posted on 2011-06-25 16:15  AlvinXiao  阅读(720)  评论(2编辑  收藏  举报