开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜