Applet-Javascript interaction

I wish for a message on my web page to say "Please wait for the applet to load ...".
[ This text can be shoved into a <div> or some other element if necessary. ]

Once my applet is loaded, I want this message to dissapear (so, removed from the <div> element it's in, for example).

How can I achieve this?

LVL 25
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I use this:

  // Cool reflection based javascript calling method
  // Taken from
  public String callBrowser( String jsCmd )
    String jsResult = null ;
    boolean success = false ;
      Method getw = null, eval = null ;
      Object jswin = null ;

      /* does it in IE too */
      Class c = Class.forName( "netscape.javascript.JSObject" ) ;

      Method ms[] = c.getMethods() ;
      for( int i = 0 ; i < ms.length ; i++ )
        if( ms[ i ].getName().equals( "getWindow" ) )
          getw = ms[ i ] ;
        else if( ms[ i ].getName().equals( "eval" ) )
          eval = ms[ i ] ;

      Object a[] = new Object[ 1 ] ;

      a[ 0 ] = this ; /* this is the applet */
      jswin = getw.invoke( c, a ) ; /* this yields the JSObject */

      a[ 0 ] = jsCmd ;
      Object result = eval.invoke( jswin, a ) ;

      if( result instanceof String )
        jsResult = (String)result ;
        jsResult = result.toString() ;

      success = true ;
    catch( InvocationTargetException ite )
      jsResult = "" + ite.getTargetException() ;
    catch( Exception e )
      jsResult = "" + e ;

      return jsResult ;
      System.out.println( "eval failed with error " + jsResult ) ;
      return null ;

Then when your applet starts call:

    callBrowser( "document.getElementById( 'theDiv' ).display = 'none'" ) ;

and make sure your div is like:

    <div id="theDiv">Please Wait For Applet to load</div>


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
you might need to put MAYSCRIPT in your applet tag :-)

Hi Rob btw :-)

InteractiveMindAuthor Commented:
Hey Tim,

thanks for that - that works great :-)

yay :-)

Good luck with it fella :-)

InteractiveMindAuthor Commented:
Cheers, Tim :-)

Heads up; I've got a new (unrelated) Q on the way ...  ;-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.