execCommand("Underline")
就可以了
就可以了
解决方案 »
- 调整javascript 图片滚动控制方式
- JS/jQuery 怎么才能实现“要刷新的地方出现‘载入中...’字样”?
- extjs gridpanenl 行(列)的计算(求助)
- div坐标的问题
- 请教inject: function()是什么意思?
- 怎么在select标签上指定选中项?
- 我在用dwr时,查询的结果总是上次所显示的
- 怎么使网页访问过一次后,返回时就过期
- 在线等:可以帮忙吗?如何用代码实现select框在得到焦点后处于已选择后状态,即onchange后的状态??
- 请问如何用Javascript来获取指定页面源代码?高手求救!
- 高手求救:谁有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目前还没有这些功能