解决img onclick事件 获得img id

hoojo 2009-03-22 06:39:00
<script type="text/javascript">

function getImg(imgid){
var str = document.revForm.imgid.id;
alter(str);
document.revForm.rcontent.value += "{" + str + "}";
}
</script>
<html:form method="post" name="revForm" action="rev_add.do">
<table width='100%' border='0' align='center' cellpadding='1'
cellspacing='1' class='unnamed1'>
<tr>
<td align='right'>
默u-29788 表u24773 :
</td>
<td>
<c:forEach begin="1" step="1" end="23" var="i">
<c:if test="${i < 10}">
<img src="img/face20${i }.gif" onclick="getImg(document.revForm.face20${i }.id)" id="face20${i }"/>
</c:if>
<c:if test="${i == 13}"><br></c:if>
<c:if test="${i >= 10}">
<img src="img/face2${i }.gif" onclick="getImg(face2${i })" id="face2${i }"/>
</c:if>
</c:forEach>
</td>
</tr>
<tr>
<td align='right' valign='top'>
内u23481 :
</td>
<td>
<html:textarea property="rcontent" cols="80" rows="6"
styleClass="input1"></html:textarea>
<font color="red"><html:errors property="rcontent" />
</font>
<br>
  
<html:submit value=" 提交 " styleClass="btn" />
 
<br>
</td>
</tr>
</table>
</html:form>
...全文
248 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hoojo 2011-02-22
  • 打赏
  • 举报
回复
 <input type="button" value="1">
hoojo 2011-02-22
  • 打赏
  • 举报
回复
:alert(1);
hoojo 2011-02-22
  • 打赏
  • 举报
回复
1
ming42740923 2009-03-22
  • 打赏
  • 举报
回复
怎么样获取图像上鼠标的坐标并写进同一个页面的表单的text文本里面?

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧