exeCommand这是什么东东啊?
解决方案 »
- js比较数字大小
- if(a)这个形式的表达式可以判断多少种?
- flash怎样调用js函数???
- 这样的效果经常看到,怎么实现?
- 挑战“百度贴吧”的分页!!有难度,请JS和HTML高手进来一观·
- 要求在textfield里只能输入十位数字,如果位数不对或是输入非数字,则弹出对话框提醒
- 救命!javascript操作Dom的问题!急!急!急!
- 如何返回并刷新?
- onclick="JavaScript:this.disabled=true" 在netscape 下应该怎么写? ----
- 关于对word的解码的问题
- 为什么有些属性在IE6好用,在IE5就不好用了。
- 说document.body对象为空,或不是对象
<title>HTML 编辑器</title>
<script>
function BtnOver(btn){
btn.style.borderTopColor="#efece8";
btn.style.borderBottomColor="#888070";
btn.style.borderLeftColor="#efece8";
btn.style.borderRightColor="#888070";
}
function BtnClick(btn){
btn.style.borderTopColor="#888070";
btn.style.borderBottomColor="#efece8";
btn.style.borderLeftColor="#888070";
btn.style.borderRightColor="#efece8";
}
function BtnOut(btn){
btn.style.borderColor="#d9cec4";
}function doCreateLink(){
doc.execCommand('CreateLink');
Editor.focus();
}
function doInsertImage(){
Editor.focus();
doc.execCommand('InsertImage','xxx');
}
function doInsertInputButton(){
Editor.focus();
doc.execCommand('InsertInputButton');
}
function doInsertHorizontalRule(){
Editor.focus();
doc.execCommand('InsertHorizontalRule');
}
function doInsertInputCheckbox(){
Editor.focus();
doc.execCommand('InsertInputCheckbox');
}
function doInsertInputRadio(){
Editor.focus();
doc.execCommand('InsertInputRadio');
}
function doInsertInputText(){
Editor.focus();
doc.execCommand('InsertInputText');
}
function doInsertInputPassword(){
Editor.focus();
doc.execCommand('InsertInputPassword');
}
function doInsertInputSubmit(){
Editor.focus();
doc.execCommand('InsertInputSubmit');
ShowMessage();
}
function doInsertInputReset(){
Editor.focus();
doc.execCommand('InsertInputReset');
ShowMessage();
}
function doInsertMarquee(){
Editor.focus();
doc.execCommand('InsertMarquee');
ShowMessage();
}
function doInsertSelectDropdown(){
Editor.focus();
doc.execCommand('InsertSelectDropdown');
}
function doInsertTextArea(){
Editor.focus();
doc.execCommand('InsertTextArea');
}
function doPrint(){
doc.execCommand('Print');
Editor.focus();
}
function doSaveAs(){
doc.execCommand('SaveAs',0,"未命名");
Editor.focus();
}
function doOpen(){
doc.execCommand('Open');
Editor.focus();
}
function EditResource(){
Preview.value=doc.body.innerHTML;
return false;
}
function ClearAll(){
doc.body.innerHTML='';
Preview.value='';
return false;
}
function SeePreview(){
doc.body.innerHTML=Preview.value;
return false;
}
function AutoPreview(){
if(vx.checked){
SeePreview();
}
}
function EditMode(){
doc.designMode = "On";
window.setTimeout('SeePreview()',100);
Preview.focus();
}
function PreviewMode(){
doc.designMode = "Off";
window.setTimeout('SeePreview()',100);
Preview.focus();
}
function ShowMessage(){
alert("请按两下物件编辑内容");
}
</script>
</head>
<body bgcolor=#e0e0e0 OnKeyUP="AutoPreview();">
<center>
<table cellpadding=0 cellspacing=1><tr>
<td><img src=editor_h.gif></td>
<td><div title="核取方块" onclick="doInsertInputCheckbox();" onmouseover="BtnOver(this);" onmouseout="BtnOut(this);" onmousedown="BtnClick(this);" onmouseup="BtnOver(this);"><img src=editor_f28.gif></div></td>
<td><div title="点选圆" onclick="doInsertInputRadio();" onmouseover="BtnOver(this);" onmouseout="BtnOut(this);" onmousedown="BtnClick(this);" onmouseup="BtnOver(this);"><img src=editor_f29.gif></div></td>
<td><div title="文字输入" onclick="doInsertInputText();" onmouseover="BtnOver(this);" onmouseout="BtnOut(this);" onmousedown="BtnClick(this);" onmouseup="BtnOver(this);"><img src=editor_f30.gif></div></td>
<td><div title="密码输入" onclick="doInsertInputPassword();" onmouseover="BtnOver(this);" onmouseout="BtnOut(this);" onmousedown="BtnClick(this);" onmouseup="BtnOver(this);"><img src=editor_f31.gif></div></td>
<td><div title="选单方块" onclick="doInsertSelectDropdown();" onmouseover="BtnOver(this);" onmouseout="BtnOut(this);" onmousedown="BtnClick(this);" onmouseup="BtnOver(this);"><img src=editor_f32.gif></div></td>
<td><div title="文字方块" onclick="doInsertTextArea();" onmouseover="BtnOver(this);" onmouseout="BtnOut(this);" onmousedown="BtnClick(this);" onmouseup="BtnOver(this);"><img src=editor_f33.gif></div></td>
<td><img src=editor_s.gif></td>
<td><div title="自订按钮" onclick="doInsertInputButton();" onmouseover="BtnOver(this);" onmouseout="BtnOut(this);" onmousedown="BtnClick(this);" onmouseup="BtnOver(this);"><img src=editor_f34.gif></div></td>
<td><div title="送出按钮" onclick="doInsertInputSubmit();" onmouseover="BtnOver(this);" onmouseout="BtnOut(this);" onmousedown="BtnClick(this);" onmouseup="BtnOver(this);"><img src=editor_f35.gif></div></td>
<td><div title="重设按钮" onclick="doInsertInputReset();" onmouseover="BtnOver(this);" onmouseout="BtnOut(this);" onmousedown="BtnClick(this);" onmouseup="BtnOver(this);"><img src=editor_f36.gif></div></td>
</tr></table></td></tr>
<tr><td bgcolor=#d9cec4><table cellpadding=0 cellspacing=1><tr>
<td><img src=editor_h.gif></td>
<td><input title="编辑模式" type=radio name=vm onclick="EditMode();" checked></td><td><div title="编辑模式"><img src=editor_e.gif></div></td><td> </td>
<td><input title="预览模式" type=radio name=vm onclick="PreviewMode();"></td><td><div title="预览模式"><img src=editor_p.gif></div></td>
</tr></table></td></tr>
<tr><td><iframe id="Editor" marginwidth=1 scrolling="auto" style="height:150px;width:100%;background-color:white;"></iframe></td></tr>
<tr><td bgcolor=#d9cec4><table cellpadding=0 cellspacing=1><tr>
<td><img src=editor_h.gif></td>
<td><button class=function onclick="EditResource();Preview.focus();">编辑原始码</button></td>
<td><button class=function onclick="ClearAll();Preview.focus();">全部清除</button></td>
<td><button class=function onclick="SeePreview();Preview.focus();">结果预览</button></td>
<td><img src=editor_s.gif></td>
<td><input title="自动预览" type=checkbox name=vx onclick="AutoPreview();Preview.focus();" checked></td><td><div title="自动预览"><img src=editor_a.gif></div></td>
</tr></table></td></tr>
<tr><td><textarea id=Preview style="height:150px;width:100%;background-color:#ffffff;overflow=auto;"></textarea></td></tr>
</table>
</center>
<script>
var doc;
doc=document.frames.Editor.document;
doc.designMode = "On";
window.setTimeout('Editor.focus()',100);
</script>
</body>
</html>
function doInsertInputRadio(){
Editor.focus();
doc.execCommand('InsertInputRadio');
doc.execCommand('InsertInputRadio');
doc.execCommand('InsertInputRadio');
doc.execCommand('InsertInputRadio');
}这样执行,只能产生1个radio!我需要4个,如何办?
因为目的是编辑试卷里的选择题,一次性同时产生四个选项;否则按4下"插入radio"按钮,操作太麻烦了。
打工好辛苦
*****
钞票好难赚
*****
编程好伤神
*****
光阴好易混
*****