获取文本框值问题

获取文本框值问题

本文介绍了Javascript,获取文本框值问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我是asp.net的新手,面临一个奇怪的问题。我在gridView里面有textBox。



我想用JavaScript获取textBox值。我已经通过互联网上的解决方案并尝试下线。



var value = document.getElementById(<%= txtNewQuizID.ClientID%>) .value;



现在离开获取值,在这一行之后,页面本身没有打开。它显示在下面的消息。



呃哦,出了点问题!错误代码:500



我试图找出这行中的错误,所以我评论了该行,但仍然是同样的问题。然后在注释行中,我删除了<%和%>页面打开正确。所以问题是由于<%和%>。请告诉解决方案如何获取textBox的值。并且在我尝试过的上述行中有什么错误。

Hi Everyone,

I am new in asp.net and facing a strange issue. I have textBox inside gridView.

I want to get the textBox value using JavaScript. I have gone through the solution available in internet and tried below line.

var value = document.getElementById("<% = txtNewQuizID.ClientID %>").value;

For now leave about getting the value, after this line, the page itself is not opening. its showing below message.

Uh-oh, something went wrong! Error Code: 500

I tried to find out whats wrong in this line, so I commented the line but still same issue. Then in commented line, i have removed "<%" and "%>" then page opens properly. So the issue is because of the <% and %>. Please tell solution how to get value of textBox. and whats wrong in above line which i tried.

推荐答案


这篇关于Javascript,获取文本框值问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 13:41