Mishigen
Mishigen

Reputation: 1261

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 javascript in master page

Upvotes: 0

Views: 211

Answers (2)

adrianos
adrianos

Reputation: 1561

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.

Upvotes: 0

Anuraj
Anuraj

Reputation: 19598

Try this

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

Upvotes: 2

Related Questions