向文本框中插入图片表情

<html>
<head>
<script language ="javascript" type="text/javascript">
function InsertPic(picpath)
{
var editor = document.getElementById('txtContent');
var img = document.createElement('img');
img.src = picpath;
editor.appendChild(img); 
}
</script>
</head>
<body>
<div>
          <img src="../images/brow1.gif" onclick="InsertPic(this.src);" />
          <img src="../images/brow2.gif" onclick="InsertPic(this.src);"/>
          <img src="../images/brow3.gif" onclick="InsertPic(this.src);"/>
          <img src="../images/brow4.gif" onclick="InsertPic(this.src);"/>
          </div>
       <textarea id="txtContent" cols="150" rows="30" runat="server">向textarea插入图片:</textarea>
 </body>
</html>
posted @ 2009-08-06 14:41  YaSin  阅读(2024)  评论(1编辑  收藏  举报