惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 刹那间我存在

一个可以放wordpress博客的PHP国外免费空间速度非常不错 重写alert,使用模态窗口强化alert。 - 刹那间我存在 - 博客园 利用 ASP.NET 的Timer 来实现的访问统计,感觉比较适合高访问量的网站 JavaScript 使用for(…in…)实现反射机制 给moz添加ie方法和属性,让firefox像IE一样编程 - 刹那间我存在 - 博客园 [原]ASP.NET 下生成的条形码。 网页中图片大小自动调整三种方法 - 刹那间我存在 - 博客园 同时支持三种事件模型 ASP调用.Net编写的动态库 - 刹那间我存在 - 博客园 整个表单元素禁用``` shtml精简教程 更改数据库所有者 BitComet超级优化设置 很酷的TOOLTip JS函数收藏 今天得到了两个 Google Analytics 的邀请 CustomValidator 控件 千万数量级分页存储过程(带效果演示) 推荐一下免费的1G网络硬盘,非常另类
[原] 用 javascript 给你的博客增加运行代码功能
刹那间我存在 · 2007-04-19 · via 博客园 - 刹那间我存在

看到别人博客有运行代码的功能不时的羡慕不已呀。想想自己经常发javascript 没有这东西怎么行,可惜我的博客又没自带这个功能,只好自己弄弄。代码比较简单,大家看看笑笑。

使用方法:
<textarea class="runCode">要运行的代码</textarea>

这里看看效果 http://dubox.cn/content-26.aspx

 function page_Init(){
  
var obj=document.getElementsByTagName("textarea");
    
for(i=0;i<obj.length;i++){
      
if(obj[i].className=="runCode"){
         
var _temid="code_"+i;
         
        
         
var html="<textArea style=\"width:80%;height:200px;border-width:1px;border-style:inset\" id=\""+_temid+"\">";
             html
+=obj[i].value;
             html
+="</textArea><br>";
             html
+="<input type=\"button\" value=\"运行代码\" onClick=\"run('"+_temid+"')\" style=\"border-width:1px\"/><em>(提示:您可以修改代码后运行)</em>";
         
var newobj=document.createElement("div");
             newobj.style.border
="1px solid #c0c0c0";
             newobj.style.backgroundColor
="#f5f7f7";
             newobj.style.padding
="10px";
             newobj.innerHTML
=html;
             
             
              if(document.all){
             obj[i].replaceNode(newobj);
             }else{
             obj[i].parentNode.replaceChild(newobj,obj[i]); 
             }

             
      }


    }

 }

 
function run(string_id){
 
var _code=document.getElementById(string_id).value;
 
var win = window.open('', "_blank", '');
        win.document.open('text
/html', 'replace');
        win.document.writeln(_code);
 }


window.onload
=page_Init;