开发者

add pages to masterpage gives me javascript error

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

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

精彩评论

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

关注公众号