# 网摘大全代码，迅速提高网站流量

- Link: https://yjyj.net/css/3836.html
- Published: 2005-12-26T04:16:23+08:00
- Author: 小 虾

⚡ 生猛大蝦编辑部 · 30 秒核心看点

 * 一篇把多家网摘收藏入口打包成代码的实战文，目标是提升页面被收藏与传播概率。
 * 核心技术是 JavaScript 读取标题、URL 和选中文本，再用 window.open 弹出收藏窗口。
 * 适合早期站点做流量增长实验：复制代码、保存为脚本、嵌入页面即可快速上线。

包括 VIVI | Younote | 365Key | Blogchina | Niula | Z365 | POCO | 人人 | Del.ico.
us | IGOOI | 亿友 | 我摘 | 和讯 | 拇指 | 天极 的收藏代码
 保存以下文件为 wangzhai.
js

    ```
    document.writeln("[ 收藏此页到 <A ");
    document.writeln("href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(vivi=window.open(\'http:\/\/vivi.sina.com.cn\/collect\/icollect.php?pid=http:\/\/www.newsunday.com&title=\'+escape(d.title)+\'&url=\'+escape(d.location.href)+\'&desc=\'+escape(t),\'vivi\',\'scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes\'));vivi.focus();\"><FONT ");
    document.writeln("color=red><B>VIVI<\/B><\/FONT><\/A> <B>|<\/B> <A href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(keyit=window.open(\'http:\/\/www.younote.com\/Noteit.aspx?t=\'+escape(d.title)+\'&u=\'+escape(d.location.href)+\'&c=\'+escape(t),\'keyit\', \'scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes\')); keyit.focus();\"><FONT ");
    document.writeln("color=red><B>Younote<\/B><\/FONT><\/A> <B>|<\/B> <A href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(keyit=window.open(\'http:\/\/www.365key.com\/storeit.aspx?t=\'+escape(d.title)+\'&u=\'+escape(d.location.href)+\'&c=\'+escape(t),\'keyit\',\'scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes\'));keyit.focus();\"><FONT ");
    document.writeln("color=red><B>365Key<\/B><\/FONT><\/A> <B>|<\/B> <a href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(keyit=window.open(\'http:\/\/blogmark.blogchina.com\/jsp\/key\/quickaddkey.jsp?k=\'+encodeURI(d.title)+\'&u=\'+encodeURI(d.location.href)+\'&c=\'+encodeURI(t),\'keyit\',\'scrollbars=no,width=500,height=430,status=no,resizable=yes\'));keyit.focus();\"><FONT ");
    document.writeln("color=red><B>Blogchina<\/B><\/FONT><\/A> <B>|<\/B> <A ");
    document.writeln("href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(keyit=window.open(\'http:\/\/www.niu.la\/jsp\/key\/quickaddkey.jsp?k=\'+encodeURI(d.title)+\'&u=\'+encodeURI(d.location.href)+\'&c=\'+encodeURI(t),\'keyit\',\'scrollbars=no,width=510,height=500,status=no,resizable=yes\'));keyit.focus();\"><FONT ");
    document.writeln("color=red><B>Niula<\/B><\/FONT><\/A> <B>|<\/B> <A href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(keyit=window.open(\'http:\/\/www.z365.cn\/saveZ.aspx?t=\'+escape(d.title)+\'&u=\'+escape(d.location.href)+\'&c=\'+escape(t),\'keyit\',\'scrollbars=no,width=450,height=510,left=75,top=20,status=no,resizable=yes\'));keyit.focus();\"><FONT color=red><B>Z365<\/B><\/FONT><\/A> <B>|<\/B> <a href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(keyit=window.open(\'http:\/\/my.poco.cn\/fav\/storeIt.php?t=\'+escape(d.title)+\'&u=\'+escape(d.location.href)+\'&c=\'+escape(t),\'keyit\',\'scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes\'));keyit.focus();\"><FONT color=red><B>POCO<\/B><\/FONT><\/A> <B>|<\/B> <a href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(rrwz=window.open(\'http:\/\/rrwz.qihoo.com\/user\/AddWebSnip.aspx?t=\'+escape(d.title)+\'&u=\'+escape(d.location.href)+\'&c=\'+escape(t),\'keyit\',\'scrollbars=no,width=475,height=450,left=280,top=50,status=no,resizable=yes\'));keyit.focus();\"><FONT color=red><B>人人<\/B><\/FONT><\/A> <B>|<\/B> <a href=\"javascript:location.href=\'http:\/\/del.icio.us\/attagirl?v=2&url=\'+encodeURIComponent(location.href)+\'&title=\'+encodeURIComponent(document.title);\"><FONT color=red><B>Del.ico.us<\/B><\/FONT><\/A> <B>|<\/B> <a href=\"javascript:u=location.href;t=document.title;void(open(\'http:\/\/www.igooi.com\/addnewitem.aspx?noui=yes&jump=close&url=\'+escape(u)+\'&title=\'+escape(t)+\'&sel=\'+escape(window.getSelection()),\'igooi\',\'toolbar=no,width=400,height=480\'));\"\"><FONT color=red><B>IGOOI<\/B><\/FONT><\/A> <B>|<\/B> <a href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(websnip=window.open(\'http:\/\/x.yeeyoo.com\/MouseAdd.aspx?t=\'+escape(d.title)+\'&u=\'+escape(d.location.href)+\'&c=\'+escape(t),\'yeeyoo\',\'scrollbars=no,width=475,height=450,left=280,top=50,status=no,resizable=yes\'));websnip.focus();;\"><FONT color=red><B>亿友<\/B><\/FONT><\/A> <B>|<\/B> <a href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(wozhai=window.open(\'http:\/\/www.wozhai.com\/wozhai\/Cento.asp#t=\'+escape(d.title)+\'&u=\'+escape(d.location.href)+\'&c=\'+escape(t),\'wozhai\',\'scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes\'));wozhai.focus();\"><FONT color=red><B>我摘<\/B><\/FONT><\/A> <B>|<\/B> <a href=\"javascript:t=document.title;u=location.href;e=document.selection?(document.selection.type!=\'None\'?document.selection.createRange().text:\'\'):(document.getSelection?document.getSelection():\'\');void(open(\'http:\/\/bookmark.hexun.com\/post.aspx?title=\'+escape(t)+\'&url=\'+escape(u)+\'&excerpt=\'+escape(e),\'HexunBookmark\',\'scrollbars=no,width=600,height=450,left=80,top=80,status=no,resizable=yes\'));wozhai.focus();\"><FONT color=red><B>和讯<\/B><\/FONT><\/A> <B>|<\/B> <a href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(keyit=window.open(\'http:\/\/www.ok4545.com\/club\/myweb_add.asp?title=\'+escape(d.title)+\'&url=\'+escape(d.location.href)+\'&c=\'+escape(t),\'keyit\',\'scrollbars=no,width=800,height=575,left=75,top=20,status=no,resizable=yes\'));keyit.focus();\"><FONT color=red><B>拇指<\/B><\/FONT><\/A> <B>|<\/B> <a href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(yesky=window.open(\'http:\/\/hot.yesky.com\/dp.aspx?t=\'+escape(d.title)+\'&u=\'+escape(d.location.href)+\'&c=\'+escape(t)+\'&st=2\',\'yesky\',\'scrollbars=no,width=400,height=480,left=75,top=20,status=no,resizable=yes\'));yesky.focus();\"><FONT color=red><B>天极<\/B><\/FONT><\/A> ]")
    ```

在你网页合适的地方插入以下代码：

❓ 延伸问答与排错指南（FAQ）

这类网摘收藏代码主要解决什么问题？

主要解决网站内容“看过就走”的问题。把收藏入口放到页面里，用户能一键把当前页提交到
收藏服务，同时带上标题、链接和选中文本，增加回访、传播和被再次访问的机会。

收藏代码里为什么要读取选中文本？

读取选中文本是为了让用户在收藏时顺手带上摘要或重点内容，提升收藏页的信息完整度。
实现上通常通过 document.selection 或 getSelection 获取文本，再拼进弹窗参数里。

把这类代码放到网站上要注意什么？

要注意兼容性和可用性：不同浏览器对 selection、window.open 的支持不完全一致；同时
要控制弹窗尺寸、避免影响主流程。实际部署前最好在目标页面测试标题、链接和选中文本
是否能正确传递。

📚 【[前端杂烩](https://yjyj.net/category/css)】专栏延伸阅读与热门精选（[全站文章归档](https://yjyj.net/archive)）：

 * [使用iframe嵌套另一页面](https://yjyj.net/css/3816.html)
 * [表格特效代码](https://yjyj.net/css/3814.html)
 * [网页框架代码](https://yjyj.net/css/3870.html)
 * [滚动图片代码](https://yjyj.net/css/3880.html)
 * 热门必读[Shopify Sessions 数据维度表](https://yjyj.net/learn/shopify/7764.html)
 * 热门必读[解决: windows 环境下 无法将“git”项识别为 cmdlet、函数、脚本文件或可运行程序的名称](https://yjyj.net/learn/7776.html)
