A simple text editor, the first editor you learnedProgramShare it. You can learn it.
<HTML>
<Head>
<Title> UBB </title>
</Head>
<Body>
<Font face = ""> </font>
<Br>
<Br>
<Table width = "300" cellspacing = "0" cellpadding = "1" border = "0" bgcolor = "buttonface">
<Tr>
<TD Height = "20px" width = "18px" onclick = 'doaction ("bold") 'onmousedown = "dodown (e_bold);" onmouseover = "on_mouseover (e_bold );"
Onmouseout = "on_mouseout (e_bold);">
</TD>
<TD Height = "20px" width = "18px" onclick = 'doaction ("italic") 'onmousedown = "dodown (e_italic);" onmouseover = "on_mouseover (e_italic );"
Onmouseout = "on_mouseout (e_italic);">
</TD>
<TD width = "pixel PX">
</TD>
</Tr>
<Tr>
<TD colspan = "3">
<IFRAME id = "Editor" name = "Editor" border = "0" scroll = "no" width = "300" Height = "200" style = "margin: 0px "> </iframe>
</TD>
</Tr>
</Table>
<Script language = "JavaScript">
// Initialize the IFRAME
Function window. onload ()
{
Editor.doc ument. designMode = "on ";
Editor.doc ument. open ();
Editor.doc ument. Write ("");
Editor.doc ument. Close ();
Editor. Focus ();
}
Function on_mouseover (thistd)
{
Thistd. style. borderleft = "1px solid buttonhighlight ";
Thistd. style. borderright = "1px solid buttonshadow ";
Thistd. style. bordertop = "1px solid buttonhighlight ";
Thistd. style. borderbottom = "1px solid buttonshadow ";
}
Function on_mouseout (thistd)
{
Thistd. style. borderleft = "";
Thistd. style. borderright = "";
Thistd. style. bordertop = "";
Thistd. style. borderbottom = "";
}
Function dodown (thistd)
{
Thistd. style. borderleft = "1px solid buttonshadow ";
Thistd. style. borderright = "1px solid buttonhighlight ";
Thistd. style. bordertop = "1px solid buttonshadow ";
Thistd. style. borderbottom = "1px solid buttonhighlight ";
Thistd. style. paddingtop = "2px ";
Thistd. style. paddingleft = "2px ";
Thistd. style. paddingbottom = "0px ";
Thistd. style. paddingright = "0px ";
}
Function doaction (STR)
{
VaR m_objtextrange = editor.doc ument. selection. createRange ();
M_objtextrange.execcommand (STR );
}
</SCRIPT>
</Body>
</Html>