日期:2014-05-17  浏览次数:20653 次

求助,验证码问题???
<tr class="bgtr">
<td align="right" style="height: 30px; width: 200px" class="required">
验证码
</td>
<td align="left">
&nbsp;&nbsp;
<input id="safecode" maxlength="4" name="safecode"
style="height: 25px; width: 230px"/>
<span id="yzm"></span>
<s:url id="imgsoft" value="/admin/getSafeCode.jspx" />
</td>
</tr>
<tr>
<td align="right" style="height: 30px; width: 200px">
&nbsp;
</td>
<td align="left">
&nbsp;&nbsp;
<img border=0 alt="鼠标点击刷新验证码"
onClick="javascript:this.src='<s:property value="%{imgsoft}"/>'"
style="cursor: hand;" src="<s:property value="%{imgsoft}"/>" />
</td>
</tr>[color=#FF00FF][/color][color=#000000][/color]


红色部分,想在页面刷新验证码,怎么获得id=imgsoft

------解决方案--------------------
验证码你可以用servlet技术写一个servlet,随机生成一个带字母或数字的图片然后在网页里调用,这个你上网搜一下这样用servlet技术的验证码代码很多。。。
------解决方案--------------------
<img id="img" border=0 alt="鼠标点击刷新验证码"
onClick="javascript:this.src='<s:property value="%{imgsoft}"/>'"
style="cursor: hand;" src="<s:property value="%{imgsoft}"/>" />

<script type="text/javascript">
$(function(){
$("#img").load($("#imgsoft").val());
})
</script>