您现在的位置是:网站首页> 编程资料编程资料
cnblogs 运行代码功能尝试_相关技巧_
2023-05-27
279人已围观
简介 cnblogs 运行代码功能尝试_相关技巧_
首先定义个文本域并且给个ID
然后定义个按钮
最后当然是要写函数了,代码如下:
function runCode(id){
var obj=document.getElementById(id);
var win = window.open('', "_blank", '');
win.document.open('text/html', 'replace');
win.opener = null;
win.document.write(obj.value);
win.document.close();
}
然后定义个按钮
最后当然是要写函数了,代码如下:
复制代码 代码如下:
function runCode(id){
var obj=document.getElementById(id);
var win = window.open('', "_blank", '');
win.document.open('text/html', 'replace');
win.opener = null;
win.document.write(obj.value);
win.document.close();
}