找回密码
 加入
搜索

[代码] 点击复制 简洁代码

[复制链接]
发表于 2009-1-28 12:14:33 | 显示全部楼层 |阅读模式
  1. <SCRIPT type=text/javascript>
  2.       function copyText(obj)
  3.       {
  4.       var rng = document.body.createTextRange();
  5.       rng.moveToElementText(obj);
  6.       rng.scrollIntoView();
  7.       rng.select();
  8.       rng.execCommand("Copy");
  9.       rng.collapse(false);}
  10.       </SCRIPT><span id="tbid"><a onclick="copyText(document.all.tbid)" href="#" title="点击复制">http://forum.lemuria.com.cn/</a></span>
复制代码
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
  4. <head>
  5. <title>Lemuria大地 - 代码测试</title>
  6. <SCRIPT>
  7. function Preview(obj)
  8. {
  9.   var TestWin=open('');
  10.   TestWin.document.write(obj.value);
  11. }
  12. function copyCode(obj) {
  13.     var rng = document.body.createTextRange();
  14.     rng.moveToElementText(obj);
  15.     rng.scrollIntoView();
  16.     rng.select();
  17.     rng.execCommand("Copy");
  18.     rng.collapse(false);
  19. }
  20. function saveCode(obj) {
  21.     var winname = window.open('', '_blank', 'top=10000');
  22.     winname.document.open('text/html', 'replace');
  23.     winname.document.writeln(obj.value);
  24.     winname.document.execCommand('saveas','','html.htm');
  25.     winname.close();
  26. }
  27. </SCRIPT>
  28. </head>
  29. <body><div><center><b>网络百宝箱 - 代码运行测试</b><br><br>
  30. <TEXTAREA id=code2 style="WIDTH: 570px; HEIGHT: 244px" rows=15 cols=47>
  31. <html>
  32. <head>
  33. <style>
  34. a {text-transform:none;text-decoration:none;}
  35. a:hover {text-decoraction:underline}
  36. </style>
  37. <LINK title=CSS href="http://box.fohee.net/js/g.css" type=text/css rel=StyleSheet>
  38. <title>沸腾网络 -网络百宝箱</title></head>
  39. <body>欢迎访问<a href="../" target="_blank" title="沸腾网络 -网络百宝箱">沸腾网络 -网络百宝箱</a><script src="http://js.tongji.linezing.com/1229594/tongji.js" type="text/javascript"></script><noscript><a href="http://www.linezing.com"><img src="http://img.tongji.linezing.com/1229594/tongji.gif"/></a></noscript>
  40. <hr size="1" noshade="noshade" style="border:1px #cccccc dotted"/>

  41. <iframe width=100% height=570 frameborder=0 scrolling=auto

  42. src="http://www.fohee.net"></iframe></body>
  43. </html>
  44. </TEXTAREA>
  45. <BR>
  46. <BUTTON onclick=Preview(code2)>运行代码</BUTTON>
  47. <BUTTON onclick=copyCode(code2)>复制代码</BUTTON>
  48. <BUTTON onclick=saveCode(code2)>另存代码</BUTTON>
  49. </div>
  50. Copyright &copy; 2009  <a href="http://www.fohee.net" target="_blank" title="沸腾网络">沸腾网络</a> All Rights Reserved<br>
  51. <a href="http://www.miibeian.gov.cn/" target="_blank">渝ICP备09005731号</a><script src="http://js.tongji.linezing.com/1229594/tongji.js" type="text/javascript"></script><noscript><a href="http://www.linezing.com"><img src="http://img.tongji.linezing.com/1229594/tongji.gif"/></a></noscript>
  52. </body>
  53. </html>
复制代码
演示http://box.fohee.net/html/

Archiver|手机版|乱弹琴|重庆网址之家|多来米发 |

GMT+8, 2024-3-29 01:55 PM

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表