Results 1 to 3 of 3

Thread: can not get applet handle by javascript in firefox

  1. #1
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default can not get applet handle by javascript in firefox

    I am running out of wisdom while calling applet by javascript in firefox 1.0.4. But the same code works in IE6. Any help here is greatly appreciated.

    I always get the value of applet handle as null in firefox. The below is the line of code, I am calling it from another frame. And the API is the name of applet defined in jsp/html as showed at the bottom of this post.

    var theApplet = parent.frames["mscp"].document.getElementById(API);

    I found the value of theApplet I got is always null in firefox, but the same code is working in IE6. I have checked the parent.frames["mscp"].document has the valid value in firefox. And I also confirmed the applet in firefox working properly since it does generate correct logs while loading it. So, there is no issue with java environment with firefox.

    I just do not know why the javascript code can not get hold of the applet in firefox, but it does in IE6.

    And the below is the code where applet included in jsp, which is at frame "mscp".

    <html>
    ....
    <body>
    .......
    <APPLET
    CODEBASE = "./lwtapplet"
    NAME = "API"
    ALT = "Tracking Applet"
    CODE = "LWTApplet.class"
    WIDTH = "300"
    HEIGHT = "400"
    HSPACE = "0"
    VSPACE = "0"
    ALIGN = "middle"
    >

    <param name="trackMode" value="<%=trackingMode%>" />
    <param name="debugMode" value="<%=curParam%>" />
    <param name="isVisible" value="<%=isVisible%>" />
    <param name="userID" value="<%=request.getRemoteUser()%>" />
    <param name="host" value="<%=request.getServerName()%>" />
    <param name="bigDogValue" value="<%=bigDogValue%>" />
    <param name="itrak.servlet.url" value="<%=servletURL%>" />
    &nbsp;
    </APPLET>
    </body>
    </html>

    Does any one know what is wrong here? Thanks.

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by zhangleif
    I always get the value of applet handle as null in firefox. The below is the line of code, I am calling it from another frame. And the API is the name of applet defined in jsp/html as showed at the bottom of this post.

    &#160;&#160;var theApplet = parent.frames["mscp"].document.getElementById(API);
    Presumably you intended to quote API -> 'API'.

    The reason is quite simple: you don't have an element with the id attribute value, 'API'. You have an applet element with a matching name attribute, but that isn't the same thing. Why it works with IE is also simple: IE is broken.

    Use the applets collection instead:

    Code:
    var theApplet = parent.frames.mscp.document.applets.API;
    Hope that helps,
    Mike

  3. #3
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You are right, got it.

    Thanks a lot

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •