Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Alternative to on Load method in BODY Tag

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

I am facing a problem wih OnLoad called in BODY tag. I want to have any alternative where I can call the required method before modify is loaded.

Problem is.....

I have a page that contains a .JS file included. That file contains all my JAvascript methods. I am calling one of the methods from the .JS file in the On Load = xyz method.

It is working fine for me in normal Browsers. But We are displaying these pages in WEBSPHERE PORTAL SERVER. When I display the page in this Portal server. On Load method is not called. So my data is not displayed. Is there any alternate to On Load method. Or can I call this from anywhere automatically before body is loaded.


Please help me in this

Thanks for your time and help
Srinivas ivaturi.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

basic idea
[ June 14, 2004: Message edited by: Eric Pascarello ]
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would slightly modify Eric's code, since there might be some action already assigned to onload handler.
 
Srinivas Ivaturi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Thanks for your help... I tried as you said but it is not working. I want this loading of method to be done in Body Onload. Eventhough I kept it in Head part in HTML page This window.onload in not called. It is not working in simple HTML page as well as in the Websphere Portal Server.

Thanks
Srinivas Ivaturi
 
Yuriy Fuksenko
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, at this case you could use setInterval or setTimeout.
With setTimeout it is pretty strait forward - pick an average time your page loads and put something like

With setInterval your function will be called every X milliseconds and it will be your function responsobility to deside, is it time to execute the code or not. In example below I use IE property document.readyState. Or you can check is the element with certain id exist, or try to call some function, that requires page to be loaded and catch exception if it is not.

[ June 14, 2004: Message edited by: Yuriy Fuksenko ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic