如何获取动态id的值
<table border="1" width="80%" align="center" style="border-collapse:separate; border-spacing:15px;">
<tr><th >方法名称</th><th>函数参数</th><th>预期结果</th><th>实际结果</th><th>操作</th></tr>
#foreach($function in $functionEnum)
<tr>
<td>$function.code $function.name<input type="hidden" value="$function.code" id="td1_$function.code"/></td>
<td><input type="text" value="" id="td2_$function.code"/></td>
<td><span id="fwResult"></span></td>
<td><span id="td3$function.code"></span></td>
<td align="center" valign="middle"><input type="button" value="提交" onclick="ljlfunction()"/></td>
</tr>
</table>
<script type="text/javascript">
function ljlfunction() {
var params = document.getElementById("td2_$function.code").value;
alert(params);
var x = document.getElementById("td1_$function.code").value;
alert(x);
</script>
这里我无法获取id为“td2_$function.code”和“td1_$function.code”的值,求解答(说一下解决思路),谢谢。
<tr><th >方法名称</th><th>函数参数</th><th>预期结果</th><th>实际结果</th><th>操作</th></tr>
#foreach($function in $functionEnum)
<tr>
<td>$function.code $function.name<input type="hidden" value="$function.code" id="td1_$function.code"/></td>
<td><input type="text" value="" id="td2_$function.code"/></td>
<td><span id="fwResult"></span></td>
<td><span id="td3$function.code"></span></td>
<td align="center" valign="middle"><input type="button" value="提交" onclick="ljlfunction()"/></td>
</tr>
</table>
<script type="text/javascript">
function ljlfunction() {
var params = document.getElementById("td2_$function.code").value;
alert(params);
var x = document.getElementById("td1_$function.code").value;
alert(x);
</script>
这里我无法获取id为“td2_$function.code”和“td1_$function.code”的值,求解答(说一下解决思路),谢谢。
...全文
相关推荐
asp.net 动态生成控件并获取其值
代码比较简单,所以不多做解释了:
『番外篇五』SwiftUI 进阶之如何动态获取任意视图的 tag 和 id 值
在本篇博文中,我们讨论了在 SwiftUI 中如何动态探查指定视图属性的值(比如 tag 或 id),并且深入扩展讲解了各种“变数”。最后,我们用基于此项技术的实例结束了整篇文章,相信大家都会受益良多。
服务器控件DropDownList控实用JS获取选中项的值
在开发过程中很多情况下都需要我们去实用JS获取服务器控件的值,但是在获取值时总是找不到控件或者值取不到,这是DropList值的获取方法,其他服务器控件获取客户端ID只需改动一下即可。
jquery中获取id值方法小结
代码如下:<div id=”product_shift_out_{m}”> </div>[removed]$(document).ready(function(){name = $(‘div’).eq(0).attr(‘id’);alert(name)});[removed] eq(0)是取第一个jq元素。。。 eq(index)匹配一个给定索引值的元素 Matches a single element by its index.返回值Element 参数index (Number) : 从 0 开始计
jquery动态赋值id与动态取id方法示例
主要给大家介绍了关于jquery动态赋值id与动态取id的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面跟着小编来一起学习学习吧。


