用这个函数:<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>
解决方案 »
- javascript中!!含义
- 求助!fileUpload图片预览IE6无效,求各位高手帮忙解决一下!
- [Extjs]怎样将grid里某行的checkbox不能选?
- 请高手帮忙,为什么我这个不能无缝滚动呢?
- 菜鸟求解:怎么样实现网页不能返回历史记录和不能刷新?
- 请教JAVASCRIPT 提示框,提示框按钮:是,否,取消
- <select><option 中怎么实现类似title 属性?>title</option></select>
- 能否取得SWF文件的宽,高,文件大小?
- 我有想法?
- Discuz论坛的验证码input框是怎么做到“失去焦点”自动验证的,在html里面没发现onblur啊
- 如何用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>