asp.net中的javascript错误 [英] javascript error in asp.net

查看:88
本文介绍了asp.net中的javascript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  var  hidval =  document  .getElementById( <%= hdhidden.ClientID%>); 
alert(hidval.value);





但是hidval总是变为null我尝试使用sigle引用但它没有帮助我不知道为什么我得到null请帮助我..





我的aspx页面是

 <   asp:HiddenField     ID   =  hdhidden      runat   =  server     =  mahesh    /  >  

解决方案

document.getElementById('<%= hdhidden.ClientID%>')。value;

试试这个。


你可以尝试这个...

var hidval = document.getElementById(hdhidden);

alert(hidval.value);





如果您在内容页面中使用...您应该尝试以下代码...





var hidval = document.getElementById('<%= hdhidden.ClientID%>')。value;

alert(hidval.value) ;

var hidval = document.getElementById("<%=hdhidden.ClientID %>");
               alert(hidval.value);



but hidval is always getting null i tried using sigle quote but it does not help i dont know why i am getting null please help me..


and my aspx page is

<asp:HiddenField ID="hdhidden"  runat="server" Value="mahesh" />

解决方案

document.getElementById('<%= hdhidden.ClientID%>').value;
try this.


You can try this...
var hidval = document.getElementById("hdhidden");
alert(hidval.value);


If you are using in content page ...you should try the below code...


var hidval = document.getElementById('<%= hdhidden.ClientID%>').value;
alert(hidval.value);


这篇关于asp.net中的javascript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆