开发者

problem in passing Id from asp.net to Javascript

开发者 https://www.devze.com 2022-12-22 02:48 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号