用这个函数:<script>function copyContent(){
with(window.fraBlank.document){
open();
write(document.all.tblCopy.outerHTML);
close();
execCommand('SelectAll');
execCommand('Copy');
execCommand('Unselect');
}
}
</script>
<table id="tblCopy"><tr><td>
<select name="t1">
<option value="999">123456789</option>
</select>
<img src="http://community.csdn.net/images/ad/banner050524.jpg">
<input type="button" value="test" >
<input type="button" onClick="copyContent()" value="copy">复制这个表格内的内容tttttttttt
</td></tr></table>
<iframe name="fraBlank" width="0" height="0" frameborder="0"></iframe>
with(window.fraBlank.document){
open();
write(document.all.tblCopy.outerHTML);
close();
execCommand('SelectAll');
execCommand('Copy');
execCommand('Unselect');
}
}
</script>
<table id="tblCopy"><tr><td>
<select name="t1">
<option value="999">123456789</option>
</select>
<img src="http://community.csdn.net/images/ad/banner050524.jpg">
<input type="button" value="test" >
<input type="button" onClick="copyContent()" value="copy">复制这个表格内的内容tttttttttt
</td></tr></table>
<iframe name="fraBlank" width="0" height="0" frameborder="0"></iframe>
解决方案 »
- 当触发 onclick="show(this.id)"> 后,如何变换链接里的图片?
- 动态追加行里的小画面打开键的取值问题
- 初学javascript 关于dom的一些疑问
- 表单文本域传值
- 把这段excel录制的宏代码,转成javascript的代码?
- 请大家帮忙看一下,难道是我逻辑错了不成?
- 对于熟悉JavaScript的达人应该很简单,循环1,2,3,4,然后输出a,b,c,d
- 请问大家现有的工具,什么能快速切割图片
- 我想实现把鼠标放在表格的单元格时,单元格中的文字的字体变色,如何实现。
- 新手JS简单问题
- 如何用javascript通过窗口名称取得窗口对象?
- 不用view-source: 如何得到一个网页的源码
<script>function copyContent(id){
with(window.fraBlank.document){
open();
write(document.all(id).outerHTML);
close();
execCommand('SelectAll');
execCommand('Copy');
execCommand('Unselect');
}
}
</script>
<span id="spn1" onclick="copyContent('spn1');">文字文字<img src="http://netserver:92/images/logo_img.jpg" ></span><br>
<span id="spn2" onclick="copyContent('spn2');"><img src="http://community.csdn.net/images/ad/banner050524.jpg"></span>
<iframe name="fraBlank" width="0" height="0" frameborder="0"></iframe>