复制表格中的内容实现了,但要运行表格中的内容要怎样实现?运行表单中的内容很容易实现,
<script>
function runEx(cod1) {
cod=document.all(cod1)
var code=cod.value;
if (code!=""){
var newwin=window.open('','','');
newwin.opener = null
newwin.document.write(code);
newwin.document.close();
}
}
</script><TEXTAREA rows=12 style='width:90%' id='cnbruce'>
<script>
alert("cnbruce")
</script>
</TEXTAREA><br>
<INPUT onclick=runEx('cnbruce') type=button value=运行代码 >但我现在是要将表格内的内容(如点击复制所选定的内容)传值为新开窗口的HTML代码!
<script>
function runEx(cod1) {
cod=document.all(cod1)
var code=cod.value;
if (code!=""){
var newwin=window.open('','','');
newwin.opener = null
newwin.document.write(code);
newwin.document.close();
}
}
</script><TEXTAREA rows=12 style='width:90%' id='cnbruce'>
<script>
alert("cnbruce")
</script>
</TEXTAREA><br>
<INPUT onclick=runEx('cnbruce') type=button value=运行代码 >但我现在是要将表格内的内容(如点击复制所选定的内容)传值为新开窗口的HTML代码!
解决方案 »
- 怎么样使用JAVASCRIPT做加减乘除运算
- jquery的$(window).resize()怎么用原生JS实现?
- 把常登陆网站在首页显示
- javascript如何验证上传图片的大小和尺寸,要兼容ie和ff
- 请教:如何实现在浏览器链接中,直接指定框架中的页面
- javascript新手求助:没有添加onclick事件,却能点击链接成功跳转。请问是正常现象吗?
- 父页面的select有一组值,有办法接受弹出窗口传过来的值改变selected吗?
- history问题?
- 如何用js取出表格中的数据(急,在线等)。
- jquery animate 可以设置哪些动画属性
- 关于框架javascript的问题,搞出来的送100分!!!
- 数据转换问题
function runEx(cod1) {
cod=document.all(cod1)
var code=cod.value;
if (code!=""){
eval(code)
}
}
</script><TEXTAREA rows=12 style='width:90%' id='cnbruce'>
alert("cnbruce")
</TEXTAREA><br>
<INPUT onclick=runEx('cnbruce') type=button value=运行代码 >
function findobj(n, d) {
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);
}
return x;
}function copycode(obj) {
var rng = document.body.createTextRange();
rng.moveToElementText(obj);
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}function runcode(obj) {
var newwin=window.open('','','');
newwin.opener = null
newwin.document.write(code0.innerText);
newwin.document.close();
}
</SCRIPT>
<table>
<tr>
<td align="right"><a href="#" onclick="runcode(findobj('code0'));">[运行]</a> <a href="#" onclick="copycode(findobj('code0'));">[复制]</a></td>
</tr><tr><td>
<table border="0" width="100%" cellspacing="1" cellpadding="10" bgcolor="#5b9a05">
<tr><td width="100%" bgcolor="#FFFFFF" ><XMP id="code0"><script>alert("xxx")</script><br>test<br>ttt</XMP></td>
</tr></table>
</td></tr>
</table>