如何在javascript中获取gridview中的文本框ID [英] How to get textbox id present in gridview in javascript..
本文介绍了如何在javascript中获取gridview中的文本框ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在javascript中获取gridview的文本框ID来检查条件。
解决方案
如何使用Javascript代码访问Gridview中的文本框值 [ ^ ]
检查生成的html&中的文本框的ID。关注它。可能会有所不同。
根据以下代码修改您的代码:
< pre lang =Javascript> document .getElementById(' ContentPlaceHolder1_GridView1_txtHours _' + i.toString())。value
function focusTextbox(txt1,txt2)
{
if (document.getElementById(txt1)。 value .length > = document.getElementById(txt1).maxLength)
{
document.getElementById(txt2).focus();
}
}
I need to get the textbox id of gridview in javascript to check the condition.
解决方案
How to access textbox values inside Gridview using Javascript code[^]
Check the id of the textbox in the generated html & follow it.It may be different.
Modify your code according to the code below:
document.getElementById('ContentPlaceHolder1_GridView1_txtHours_' + i.toString()).value
function focusTextbox(txt1,txt2) { if( document.getElementById(txt1).value.length >=document.getElementById(txt1).maxLength ) { document.getElementById(txt2).focus(); } }
这篇关于如何在javascript中获取gridview中的文本框ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文