execCommand("Underline")
就可以了
就可以了
解决方案 »
- ExtJS GridPanel加上复选框,选中行问题
- JS写的拼图代码中的一个函数,看不懂,急盼大牛指点!!!!
- 正则表达式分组
- 请哪位高手帮我改下JS!
- 寻找一款优秀的JavaScript或Ajax的Eclipse插件
- Javascript继承机制总结 + 散分
- showModelessDialog的对话框如何设置成和父页面一样的大小!
- 上传图片获取图片大小、高度和宽度,在线等。
- 高分求解决方法,最好是能直接在js里实现的
- jQuery在ie9下不兼容怎么回事
- 高手求救:谁有ubb code 函数代码库?我曾经down了一些,但是不够用,如果同时在内容中插入两幅图片,就不能正常显示该图片,我已经被难
- 小问题,解决后立刻给分!!!
<HTML>
<HEAD>
<TITLE>Editable Regions Sample</TITLE>
<STYLE>
BODY{margin:0; background:white;
font-family:verdana;
font-size:80%;}
BUTTON {cursor:hand;
background:#ffffff;
border-color:#99ccff;
font-weight:bold;}
.bar{background:#336699;
width:100%;
height:30px;
border-top:1px solid #99CCFF;
border-bottom:1px solid #000000;}
.desbar{background:#FFFFFF;
width:100%;
padding: 10px;
border-top:1px solid #CCCCCC;
border-bottom:1px solid #000000;
color:black;
font-size:8pt;
height:105;}
.title{font-size:15pt;
color:white;
padding-left:10px;}
.bar A:link {text-decoration:none; color:white}
.bar A:visited {text-decoration:none; color:white}
.bar A:active {text-decoration:none; color:white}
.bar A:hover {text-decoration:none; color:yellow}
</STYLE><SCRIPT>function fnInit(){
for (i=0; i<document.all.length; i++)
document.all(i).unselectable = "on";
oDiv.unselectable = "off";
}function fnToggleEdits(oObj,oBtn) {
currentState = oObj.isContentEditable;
newState = !currentState;
oObj.contentEditable = newState; newState==false ? oBtn.innerHTML='Turn Editing On' :
oBtn.innerHTML='Turn Editing Off';
}</SCRIPT>
</HEAD><BODY onload="fnInit();"><DIV CLASS="desbar">
<H4 style="font-size:10pt;">This example demonstrates the features of
Microsoft® Internet Explorer that enable users to edit the content
of an HTML element directly from the browser.</H4>
<P>This HTML editor is a <B>DIV</B> element set to be content-editable. Any
valid HTML content (text, images, form controls, etc.) can be pasted
and edited in this editor.</P> <DIV ALIGN="center">
<DIV ALIGN="center" STYLE="height:210; width:90%;
background-color:#99CCFF; border:1px solid black">
<DIV CLASS="bar title">HTMLEditor (Content-Editable DIV)</DIV> <DIV style="padding:10px">
<BUTTON ID="oEditDiv" TITLE="Turn Editing Off"
onclick='fnToggleEdits(oDiv,oEditDiv);oDiv.focus();'>
Turn Editing Off</BUTTON>
<BUTTON ID="oBoldBtn" TITLE="Bold"
onclick='if (oDiv.isContentEditable==true)
document.execCommand("Bold");'><B>Bold</B></BUTTON>
<BUTTON ID="oItalicBtn" TITLE="Italic"
onclick='if (oDiv.isContentEditable==true)
document.execCommand("Italic");'><I>Italic</I></BUTTON>
<BUTTON ID="oUndLnBtn" TITLE="Underline"
onclick='if (oDiv.isContentEditable==true)
document.execCommand("Underline");'><U>Underline</U></BUTTON>
</DIV>
<DIV id=oDiv CONTENTEDITABLE ALIGN=left STYLE="height:100;
width:95%;background-color:white; font-face:Arial; padding:3;
border:inset #99ccff; scrollbar-base-color:#99ccff;
overflow=auto;"></DIV>
</DIV>
</DIV>
</body>
</html>
据我所知,javascript目前还没有这些功能