想关代码:function runCode() //定义一个运行代码的函数,
{
var code=event.srcElement.parentElement.children[0].value;
var newwin=window.open('','','height=400, width=650, top=0,left=0,toolbar=1, menubar=1, scrollbars=1, resizable=1, location=1, status=1');
newwin.opener = null // 防止代码对论谈页面修改
newwin.document.write(code);
newwin.document.close();
newwin.document.charset="UTF-8";
}<input type="button" value="运行代码" onclick="runCode();">
{
var code=event.srcElement.parentElement.children[0].value;
var newwin=window.open('','','height=400, width=650, top=0,left=0,toolbar=1, menubar=1, scrollbars=1, resizable=1, location=1, status=1');
newwin.opener = null // 防止代码对论谈页面修改
newwin.document.write(code);
newwin.document.close();
newwin.document.charset="UTF-8";
}<input type="button" value="运行代码" onclick="runCode();">
解决方案 »
- 请教一个JS问题,IE运行“拒绝访问”,FF运行没问题
- javascript脚本为什么只执行了一半
- 求用javascript修改文件名的代码~
- Number 和 parseInt 完全一样么? 有什么区别?用哪个好?
- 判断复选框的问题!
- 关于数字和小数点
- 一个问题?
- javascript如何取網址里的變量?
- IE6.0为什么无法运行window.open()
- 有一个框架网页,A和B,B又新打开了一个新网页,这个网页又是一个框架网页,分别为C和D,现在我在父窗口B中要改变D的<form中的scr的值,
- 如何把2显示为2.00
- 点href链接时状态栏总会出现要链接的网址,就是设了 <a onmouseover="window.status='hello'" > 也还会出现网址啊,怎么不让它出现要链接的
function runEx(){
var winEx2 = window.open("", "winEx2",""); winEx2.document.open("text/html", "replace");
winEx2.document.write(unescape(event.srcElement.parentElement.children[0].value));
winEx2.document.close();
}
function saveFile()
{
var win=window.open('','','top=10000,left=10000');
win.document.write(document.all.asdf.innerText)
win.document.execCommand('SaveAs','','copy.htm')
win.close();
}
</SCRIPT>
复制代码 onclick="JM_cc('textfield')"<SCRIPT language=JavaScript>
<!--function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function JM_cc(ob){
var obj=MM_findObj(ob); if (obj) {
obj.select();js=obj.createTextRange();js.execCommand("Copy");}
}function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
//--></SCRIPT>