Firefox javascript won't work (works in IE)

Discussion in 'ASP .Net' started by Altman, Feb 14, 2007.

  1. Altman

    Altman Guest

    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.
    Altman, Feb 14, 2007
    #1
    1. Advertising

  2. Altman

    Teemu Keiski Guest

    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


    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net




    "Altman" <> wrote in message
    news:...
    >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.
    >
    Teemu Keiski, Feb 14, 2007
    #2
    1. Advertising

  3. Altman

    Altman Guest

    On Feb 14, 9:11 am, "Teemu Keiski" <> wrote:
    > 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
    >
    > --
    > Teemu Keiski
    > AspInsider, ASP.NET MVPhttp://blogs.aspadvice.com/jotekehttp://teemukeiski.net
    >
    > "Altman" <> wrote in message
    >
    > news:...
    >
    > >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.


    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.
    Altman, Feb 14, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chad
    Replies:
    4
    Views:
    8,328
  2. LRW
    Replies:
    5
    Views:
    120
    Dr John Stockton
    Dec 3, 2004
  3. LAshooter

    Javascript won't work in Firefox

    LAshooter, Jun 27, 2005, in forum: Javascript
    Replies:
    5
    Views:
    126
    Thomas 'PointedEars' Lahn
    Jul 15, 2005
  4. Replies:
    2
    Views:
    94
    atetlaw
    Jun 22, 2006
  5. Igal

    javascript won't work with FireFox

    Igal, Jan 22, 2007, in forum: Javascript
    Replies:
    3
    Views:
    102
Loading...

Share This Page