problem in passing Id from asp.net to Javascript
I need to call a functoin on button click and pass the value of id into that function...here is what I m doing ...but I bet i m doing sth wrong bcoz its not working
function Datarate(frm) {
var ar = document.getElementById('<开发者_JS百科;%= submit.ClientID%>');
alert(ar);
}
<asp:Button runat="server" ID="submit" Text="Submit" OnClientClick="return Datarate(this.form);" PostBackUrl="www.google.com" />
but i m getting alert as null...
any idea where I m getting wrong... Thanks,
var ar = document.getElementById('<%= submit.ClientID%>').value;
alert(ar);
Try adding .value
精彩评论