开发者

add pages to masterpage gives me javascript error

i have a page which uses some javascript code to run,it was working fine until i added it to master page, on adding it to master page it gives me an error from javascript

var fu1 = document.getElementById("FileUpload1");
 var ex1 = extension(fu1.value) ; object expected in fu1.value

i need to know where to add the jav开发者_如何转开发ascript in master page


Try this

var fu1 = document.getElementById("<%= FileUpload1.ClientID %>");
var ex1 = extension(fu1.value) 


I'm guessing you have one of these controls:

<input id="FileUpload1" runat="server" type="file" />

If so, you can access it in Javascript like so:

var fu1 = document.getElementById('<%= FileUpload1.ClientID %>');

Don't forget the runat="server" on the control.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜