<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<textarea id="txtMessage" rows=10 cols=100> 先将光标置在这里任意处,然后点击按钮,看内容变化。 </textarea>
<br>
<!--注意,这里必须是javascript,用onclick是不可用的-->
<a href="javascript:AddFace(':)')">测试
</a>
<script language="JavaScript" type="text/javascript">
function AddFace(NewCode) {
document.all("txtMessage").focus();
var sel = document.selection.createRange();
sel.text=NewCode;//sel.moveStart("character",-1);//去除一个字符
return;
}
</script>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<textarea id="txtMessage" rows=10 cols=100> 先将光标置在这里任意处,然后点击按钮,看内容变化。 </textarea>
<br>
<!--注意,这里必须是javascript,用onclick是不可用的-->
<a href="javascript:AddFace(':)')">测试
</a>
<script language="JavaScript" type="text/javascript">
function AddFace(NewCode) {
document.all("txtMessage").focus();
var sel = document.selection.createRange();
sel.text=NewCode;//sel.moveStart("character",-1);//去除一个字符
return;
}
</script>
</BODY>
</HTML>