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.
精彩评论