Firefox javascript won't work (works in IE)

A

Altman

I have created an ascx control and I am calling
registerclientscriptblock. The path to the js file is relative to the
aspx page and not the ascx file. The function runs fine in IE7 but in
Firefox the error console says that the function is not defined. I
tried making a very basic js file to get it to work and I am having
the same problem. My js file is as follows

function testjs()
{
alert("test fired");
}

I look at the page source in Firefox and it looks correct
<script src="/JavaScript/test.js" type="text/jscript"></script>

My page that i am running is /test.aspx and the js file is located in /
JavaScript/test.js. I put an <input> on with onclick="testjs();" and
firefox says testjs is not defined. I am at a loss as to why this
won't work but works fine in IE. I am not doing any specific IE
functions.
 
T

Teemu Keiski

I think it should be

<script src="/JavaScript/test.js" type="text/javascript"></script>

(Note jscript --> javascript). JScript is IE-specific stuff, so Firefox
probably ignores it because of the type
 
A

Altman

I think it should be

<script src="/JavaScript/test.js" type="text/javascript"></script>

(Note jscript --> javascript). JScript is IE-specific stuff, so Firefox
probably ignores it because of the type

OMG I cannot believe I didn't see that. Guess I need to pay more
attention to intellisense. I never used the jscript before I don't
know how I missed it now. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top