您的位置:首页 > Web前端 > JavaScript

打开,另存为,属性以及将内容复制到剪贴板等JS代码

2007-01-12 14:26 716 查看

[align=center] [/align]
[align=center][/align]

■打开■
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■另存为■
<input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■属性■
<input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■打印■
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■页面设置■
<input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■刷新■
<input type=button value=刷新 name=refresh onclick="window.location.reload()">
■导入收藏■
<input type="button" name="Button" value="导入收藏夹" onClick=window.external.ImportExportFavorites(true,);>
■导出收藏■
<input type="button" name="Button3" value="导出收藏夹" onClick=window.external.ImportExportFavorites(false,);>
■加入收藏■
<INPUT name=Button2 onclick="window.external.AddFavorite(location.href, document.title)" type=button value=加入收藏夹>
■整理收藏夹■
<INPUT name=Submit2 onclick="window.external.ShowBrowserUI(OrganizeFavorites, null)" type=button value=整理收藏夹>
■查看原文件■
<INPUT name=Button onclick=window.location = "view-source:" + window.location.href type=button value=查看源文件>
■语言设置■
<INPUT name=Button onclick="window.external.ShowBrowserUI(LanguageDialog, null)" type=button value=语言设置>
■前进■
<INPUT name=Submit onclick=history.go(1) type=submit value=前进>
■后退■
<INPUT name=Submit2 onclick=history.go(-1) type=submit value=后退>

<Script Language=Jscript>
alert(clipboardData.getData('text')) //取得当前的剪切版内容
window.clipboardData.setData('text','指定数据') //自定义剪切版中的内容
alert(clipboardData.getData('text')) //在次取得当前剪切版内容
</Script>

<BODY>
<script>
function copyToClipBoard()
{
var clipBoardContent=window.document.title;
clipBoardContent+='/r/n' + window.document.location.href;
window.clipboardData.setData("Text",clipBoardContent);
alert("复制成功,请粘贴到你的QQ/MSN上推荐给你的好友!/r/n/r/n内容如下:/r/n" + clipBoardContent);
}
</script>
<INPUT title='点击复制标题和地址到剪贴版,直接在MSN/QQ上粘贴即可.' type=button value='点击复制本页地址,传给QQ/MSN上的好友' onclick='copyToClipBoard()'>

</BODY>

<script>
function oCopy(obj){
obj.select();
js=obj.createTextRange();
js.execCommand("Copy")
}
</script>

<input name="intext" id="intext" value="复制的内容" size="80" maxlength="200">
<input type=button value="复制" onclick="oCopy(intext);" />

<script language="javascript">
function copyText(id) {
try{
var targetText = document.getElementById(id);
targetText.focus();
targetText.select();
var clipeText = targetText.createTextRange();
//if (clipeText!=null) alert(clipeText.htmlText);
clipeText.execCommand("Copy");
}catch(e){}
}
</script>
<form>
<input type="text" id="sdfa" value="http://www.souv.cn">
<input type="button" value="复制" onclick="copyText('sdfa');this.value='完成';this.disabled='true'">
</form

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: