ÔÚÍøÉÏÒ»ËÑ¿ÉÒÔ¿´µ½ºÜ¶àÀàËƵĴúÂ룬¼ÓÈëÍøÒ³body²¿·Ö¾Í¿ÉÒÔ¡£
ÀýÈçÏÂÃæÕâ¶Î´úÂ룺
- //¸´ÖÆÄÚÈÝ×Ô¶¯Ìí¼Ó°æȨÐÅÏ¢
- document.body.oncopy = function ()
- {
- setTimeout(
- function ()
- {
- var text = clipboardData.getData("text");
- if (text)
- {
- text = text + "\r\nÔÎijö×Ô¡¾°®Ë¼×ÊÔ´Íø¡¿£¬×ªÔØÇë±£ÁôÔÎÄÁ´½Ó£º"+location.href;
- clipboardData.setData("text", text);
- }
- },
- 100
- )
- }
Õâ¶Î´úÂë¾Í¿ÉÒÔʵÏÖ£¬±ðÍüÁËҪдÔÚjsÎļþÖлòÕßÖ±½ÓдÔÚÒ³ÃæÖÐÓÃ
¼ÓÉÏÒÔÉÏ´úÂëºó£¬±ðÈËÔÚÄãÍøÕ¾µÄÈκÎÒ»¸öÒ³Ã棬¸´ÖÆÈκÎÒ»¸öÎÄ×ֵĶ«Î÷£¬Õ³Ìùʱ¶¼»á×Ô¶¯´øÉÏ°æȨÐÅÏ¢¡£<script ="text/javascript"> ´úÂë </script>°üº¬½øÈ¥¡£
µ«Õâ¸ö´úÂëµÄ²»×ãÖ®´¦ÊÇ£ºÔÚIE6ÉϲâÊÔͨ¹ý£¬¶øÔÚFirefox¡¢Operaä¯ÀÀÆ÷ÉÏûÓÐЧ¹û¡£
ΪÁ˽â¾öÕâ¸öÎÊÌ⣬Çë½ÌÁ˺ܶà¸ßÊÖ£¬Ò²ÔÚÍøÉϲéÁ˺ܶà×ÊÁÏ£¬ÖÕÓÚ½â¾öÁË£¬ÔÚÕâÀïÏë˵һ¾ä£¬¶ÈÄïÕæµÄºÜÇ¿´ó¡£
ÒÔÏÂÌù³ö¼æÈÝ´úÂë:
Õâ¸ö´úÂë¾²âÊÔ£¬¿ÉÒÔ¼æÈÝ£¬¿ÉÄÜ»¹Óв»×ãµÄµØ·½£¬ÈçÓз¢ÏÖ£¬¿ÉÒÔÔÚÏ·½ÁôÑÔ£¬¹²Í¬Ì½ÌÖ¡¢¸Ä½ø¡£
- //¸´ÖÆÄÚÈÝ×Ô¶¯Ìí¼Ó°æȨÐÅÏ¢
- var Sys = {};
- var ua = navigator.userAgent.toLowerCase();
- if( window.ActiveXObject )
- {
- document.body.oncopy=function()
- {
- event.returnValue = false;
- var t=document.selection.createRange().text;
- var s="\r\nÔÎijö×Ô[°®Ë¼×ÊÔ´Íø] תÔØÇë±£ÁôÔÎÄÁ´½Ó:"+location.href;
- clipboardData.setData('Text',t+'\r\n'+s);
- }
- }
- else
- {
- function addLink()
- {
- var body_element = document.getElementsByTagName('body')[0];
- var selection;
- selection = window.getSelection();
- var pagelink = "
ÔÎijö×Ô[°®Ë¼×ÊÔ´Íø] תÔØÇë±£ÁôÔÎÄÁ´½Ó:"+document.location.href;- var copytext = selection + pagelink;
- var newdiv = document.createElement('div');
- newdiv.style.position='absolute';
- newdiv.style.left='-99999px';
- body_element.appendChild(newdiv);
- newdiv.innerHTML = copytext;
- selection.selectAllChildren(newdiv);
- window.setTimeout
- (
- function()
- {
- body_element.removeChild(newdiv);
- },0
- );
- }
- document.oncopy = addLink;
- }
×îºÃ˵һµã£¬×¢Òâ±àÂëÎÊÌ⣬Èç·¢ÏÖ¸´ÖƵÄÄÚÈÝÌí¼ÓµÄ°æȨÐÅÏ¢ÂÒÂ룬¿ÉÒÔ×ÔÐмì²é±àÂëÎÊÌâ¡£
±¾Õ¾»¶ÓÈκÎÐÎʽµÄתÔØ£¬µ«ÇëÎñ±Ø×¢Ã÷³ö´¦£¬×ðÖØËûÈËÀͶ¯³É¹û
תÔØÇë×¢Ã÷£º ÎÄÕÂתÔØ×Ô£º°®Ë¼×ÊÔ´Íø http://www.aseoe.com/show-12-542-1.html
תÔØÇë×¢Ã÷£º ÎÄÕÂתÔØ×Ô£º°®Ë¼×ÊÔ´Íø http://www.aseoe.com/show-12-542-1.html