• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Firefox unable to detect the javascript on onload event

 
Ranch Hand
Posts: 59
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I am facing the problem in Firefox version 3.0.6 it was working fine till Firefox version 3.0.3 as well as other browsers such as IE5,6,7 and Flock

Scenario :

Web page loads successfully first time. Then, redirected to the alert message box. While returning back from the alert message box which is having only one button OK. The parent page goes blank.
I had written the javascript function which needs to be called on onload event of the page. This function is successfully invoked in all other browsers except the Firefox 3.0.6.

But, when I had explicitly put an alert message in the javascript function then it is working fine!

Totally confused about the behaviour of the browsers.

Is there any way to sort the above problem.

Please refer the below code snippet



When look in the Error Console of the firefox it displays the onLoadWindow() not defined.

If it was not defined then how come the IE and FLOCK refer and display the page correctly?

Please help totally messed up....! Because the same is working in the lower version of Firefox!

 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need quotes around it

Better to use the following in your script tag





Eric
 
Rizwan Patel
Ranch Hand
Posts: 59
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eric,

I have given the double quotes around the function call! Then also it did not working.

 
Ranch Hand
Posts: 608
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code looks fine to me except for the strange looking alert alert(\n\"HI\"\n)"); why are the quotes so weird and whats with the extra brackets? There is no way this could work on any browser

What works fine for me (Firefox 3.0.6) is


Of course putting inline java script code is considered pretty bad practice, but I don't think firefox should be stopping you. The problem you getting is almost associated with something else being wrong in your code. Probably you need to post you actual code, if you still face the problem.
 
Rizwan Patel
Ranch Hand
Posts: 59
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the Reply,

Now I have modify the code as par the suggestion missing quotes in alert box.

It works fine for some time and after two three attempts means refreshing the page,the error console displays the same error method not defined.

Not solved. I had check the source code again and found that method is present.
Is there any property which we need to handle propertly? in firefox!
 
Saifuddin Merchant
Ranch Hand
Posts: 608
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried out the code too and it works fine for me (actually its elementary Java Script and should work anyways).
More ever the code working fine a couple of time and then not working is pretty strange behavior for Java Script (well unless Ajax is involved! Then it starts to get complicated )

Can you post the exact source code that you are trying out?

Also can you give a screen shot or exact posting of the error it shows in console? BTW (by the way) which console are you talking about - are you using firebug?
 
Rizwan Patel
Ranch Hand
Posts: 59
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Error console in Firefox browser -> Tools -> Error Console

Yes I have checked in Firebug also but the same problem? It displays the method undefined
 
Saifuddin Merchant
Ranch Hand
Posts: 608
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Works fine for me. No Errors in the FireFox Error Console or Firebug ...
 
reply
    Bookmark Topic Watch Topic
  • New Topic