回 帖 发 新 帖 刷新版面

主题:有关document.execCommand

大家好,我刚开始学网络编程,请教一下为什么运行下面一段代码,其中黑体,斜体,下划线等都无法实现相关的功能啊?谢谢大家...

<input type=button value=剪切 onclick=document.execCommand('Cut')>
<input type=button value=拷贝 onclick=document.execCommand('Copy')>
<input type=button value=粘贴 onclick=document.execCommand('Paste')>
<input type=button value=撤消 onclick=document.execCommand('Undo')>
<input type=button value=重做 onclick=document.execCommand('Redo') id=button2 name=button2>
<input>
<input type=button value=删除 onclick=document.execCommand('Delete')>
<input type=button value=黑体 onclick=document.execCommand('Bold')>
<input type=button value=斜体 onclick=document.execCommand('Italic')>
<input type=button value=下划线 onclick=document.execCommand('Underline')>
<input type=button value=停止 onclick=document.execCommand('stop')>
<input type=button value=保存 onclick=document.execCommand('SaveAs')>
<input type=button value=另存为 onclick=document.execCommand('Saveas',false,'c:\\test.htm')>
<input type=button value=字体 onclick=document.execCommand('FontName',false,fn)>
<input type=button value=字体大小 onclick=document.execCommand('FontSize',false,fs)>
<input type=button value=刷新 onclick=document.execCommand('refresh',false,0)>  
 <SCRIPT>
function executeCommand()
{
var testCommand = document.execCommand("SaveAs", true, "fk");
}
-->
</script> 

回复列表 (共1个回复)

沙发

因为你用错了
我回你贴了..方法在这可以看到:
http://www.programfan.com/club/showbbs.asp?id=229363

我来回复

您尚未登录,请登录后再回复。点此登录或注册