第一段代码可以正常运行,第二段怎么就不行呢<s:iterator value="types">
<input type="radio" name="type" onclick="getDicName('<s:property value="typeid"/>',
'<s:property value="name"/>')"><s:property value="name"/>
</s:iterator>第一段代码,查看源码是<input type="radio" name="type" onclick="getDicName('2','瑜伽')">瑜伽
第二段代码,查看源码只是 getDicName('typeid','name')
<s:iterator value="types">
<s:radio name="type" list="name" onclick="getDicName('typeid','name')"/>
</s:iterator>
第二段怎么改写才可以呢,请大侠赐教,谢谢
<input type="radio" name="type" onclick="getDicName('<s:property value="typeid"/>',
'<s:property value="name"/>')"><s:property value="name"/>
</s:iterator>第一段代码,查看源码是<input type="radio" name="type" onclick="getDicName('2','瑜伽')">瑜伽
第二段代码,查看源码只是 getDicName('typeid','name')
<s:iterator value="types">
<s:radio name="type" list="name" onclick="getDicName('typeid','name')"/>
</s:iterator>
第二段怎么改写才可以呢,请大侠赐教,谢谢
解决方案 »
- java listener和Spring注入问题
- spring + mybatis报错,这是神马问题?
- JAva
- 使用Spring测试框架TestContext的问题:java.lang.NoClassDefFoundError: org/junit/Assum$Assum
- ajax请求的数据需要查询很长时间,怎么让他先显示一部分
- 分配教师策略
- Java程序用JXL.JAR包写数据到EXCEL文件问题,求救,谢谢!
- 急呀!!!关于Hibernate 查询的问题!!!
- hibernate中hql问题
- JBoss Servlet+JSP+Hibernate 出错有人见过这错误信息?
- 假如我数据库里一条数据的内容改变了 怎样监听呢?
- 谁能帮我看看这是个什么错
<s:radio name="type" list="addOrSubList" listKey="code" listValue="codeVal" onclick="getName(this.value,this.nextSibling.innerText)"/>
list:一个list listkey:list中对象的code属性 listValue:list中对象的codeVal属性 解析成HTML的元素 其中 HTML中的value : 上面的listValue
而onclick事情中,是使用js来获取元素值,this.value = radio对象的value
this.nextSibling 在同级中的下一个元素 的 innerText内容
了解下js的代码就能看懂
<input type="radio" name="type" id="type0" value="0" onclick="getNamethis.value,this.nextSibling.innerText)"/>
<label for="type0">未减人员</label>
<input type="radio" name="type" id="type1" value="1" onclick="getName(this.value,this.nextSibling.innerText)"/>
<label for="type1">已减人员</label>
typeid,name始终都是被当作一个字符串而不是表达式
getName(this.value,this.nextSibling.innerText) 在参数上不要添加引号。
俩个参数是通过 js的对象来获取的
<s:radio />
标签解析成
<input type="radio" name="type" id="type0" value="0" onclick="getName(this.value,this.nextSibling.innerText)"/>
<label for="type0">未减人员 </label>
<input type="radio" name="type" id="type1" value="1" onclick="getName(this.value,this.nextSibling.innerText)"/>
<label for="type1">已减人员 </label>你要看清楚引号的位置
期待高手的加入