87,910
社区成员
发帖
与我相关
我的任务
分享
<input value="剪贴" type="button" onclick="oo('cut')" />
<div style="height:300px; width:600px; border:1px solid #000000">
<iframe id="HtmlEditor" src="" frameborder="0" marginheight="0" marginwidth="0" style="width:100%; height:100%;">d</iframe>
<br><br>
</div>
<script>
var f = document.getElementById("HtmlEditor");
var html = '<HEAD></HEAD><BODY><div></div></BODY>';
f.contentWindow.document.open("text/html", "replace");
f.contentWindow.document.write(html);
f.contentWindow.document.close();
f.contentWindow.document.designMode = "on";
function format(type, para){
f.focus();
f.document.execCommand(type)
}
function oo(pp){format(pp)}
</script>
<input value="剪贴" type="button" onclick="oo('cut')" />
<input value="复制" type="button" onclick="oo('copy')" />
<input value="粘贴" type="button" onclick="oo('paste')" />
<input value="加粗" type="button" onclick="oo('bold')" />
<input value="斜体" type="button" onclick="oo('italic')" />
<div style="height:300px; width:600px; border:1px solid #000000">
<iframe id="HtmlEditor" src="" frameborder="0" marginheight="0" marginwidth="0" style="width:100%; height:100%;">d</iframe>
<br><br>
</div>
<script>
var f = document.getElementById("HtmlEditor");
var html = '<HEAD></HEAD><BODY><div></div></BODY>';
f.contentWindow.document.open("text/html", "replace");
f.contentWindow.document.write(html);
f.contentWindow.document.close();
f.contentWindow.document.designMode = "on";
function format(type, para){
f.focus();
if(!para) f.document.execCommand(type);
else f.document.execCommand(type,false,para);
f.focus();
}
function oo(pp){f.focus();format(pp)}
</script>
//赋值到剪切板
function copyToClipboard(txt){
if(window.clipboardData) {
window.clipboardData.clearData();
window.clipboardData.setData("Text", txt);
} else if(navigator.userAgent.indexOf("Opera") != -1) {
window.location = txt;
} else if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch (e) {
alert("被浏览器拒绝!\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
}
var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
if (!clip)
return; var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
if (!trans)
return;
trans.addDataFlavor('text/unicode');
var str = new Object();
var len = new Object();
var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
var copytext = txt;
str.data = copytext;
trans.setTransferData("text/unicode",str,copytext.length*2);
var clipid = Components.interfaces.nsIClipboard;
if (!clip)
return false;
clip.setData(trans,null,clipid.kGlobalClipboard);
}
alert(txt+"\r\n\r\n复制成功!通过Ctrl+V快速粘贴");
}
function Pop(){
clonePic();
new Marquee("ListTsls",0,15,560,240,30,4000,6000)
}
function clonePic(){
$(".piclisttsls").clone(true).appendTo("#ListTsls");
}