求一个关闭页面提示加入收藏的代码
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>关闭窗口时提示添加到收藏夹</title>
</head>
<body onunload="book()">
<p>关闭本窗口看效果</p>
<p></p> </body>
</html>
<script language="javascript">
function book(){
window.external.AddFavorite('http://www.cnwshow.com', '中国个人网页秀')
}</script>
为什么这样不行呢,无论js放在head里还是最后都不行,请高手帮忙解决一下
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>关闭窗口时提示添加到收藏夹</title>
</head>
<body onunload="book()">
<p>关闭本窗口看效果</p>
<p></p> </body>
</html>
<script language="javascript">
function book(){
window.external.AddFavorite('http://www.cnwshow.com', '中国个人网页秀')
}</script>
为什么这样不行呢,无论js放在head里还是最后都不行,请高手帮忙解决一下
解决方案 »
- 谁能帮忙写个cookie代码啊
- javaScript 实现鼠标位置控制
- FF下 document.documentElement.scrollTop只表示body对象的,而其他的比如div,span之类
- Event事件怎麼找不到事件?
- 有什么简便的写法根据传递来的值指定下拉框的默认值是哪一个
- "self.location.reload()"刷新时怎么去掉‘重试’提示?
- 如何将一个例如"2004-09-13 23:59"的字符串转换为一个Date对象?
- (JavaScript)怎么在一个文件夹里面搜索出来某一名字的文件
- <pre></pre>是什么标签?
- 送分兼骗钱,大家来看看!冒着被骂死的危险... ...
- 请问一下这个网站的在线编辑功能是如何实现的?
- 求个网站左侧多级子栏目列表?
代码如下:<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>关闭窗口时提示添加到收藏夹</title><script language="javascript">
function book(){
window.external.AddFavorite('http://www.cnwshow.com', '中国个人网页秀')
}</script>
</head>
<body onbeforeunload="book()" >
<p>关闭本窗口看效果</p>
<p></p> </body>
</html>
1. function addit()/*定义加入收藏夹功能的函数;*/ {
2. window.external.addFavorite(location,document.title);
3. } <a href="#" onClick="addit()">加入收藏</a>
这句好像不起作用.
window.onunload = function(){
window.external.AddFavorite('http://www.cnwshow.com', '中国个人网页秀');
};