createElement applet and Opera 7

Discussion in 'Javascript' started by Tormod Omholt-Jensen, Sep 18, 2003.

  1. Ï need to dynamically insert an applet into a document. In IE 6.0 my code
    works fine, but there seems to be problems in Opera 7. The page looks
    like there is allocated space for an applet. Printing the size of the
    document.applets array return as expected 0 before the insertion, and 1
    after, in both Opera 7 and IE. However, the applet does not init properly
    (no painting).

    Anyone?

    Regards Tormod Omholt-Jensen


    ------------------- C O D E -----------------

    <script language="JavaScript1.2">

    var applet = document.createElement("applet");
    applet.code = "MyApplet.class";
    applet.height = "50";
    applet.width = "50";
    applet.defer = true;

    document.body.appendChild(applet);

    </script>
     
    Tormod Omholt-Jensen, Sep 18, 2003
    #1
    1. Advertising

  2. Hi,

    Tormod Omholt-Jensen wrote:

    > Ï need to dynamically insert an applet into a document. In IE 6.0 my code
    > works fine, but there seems to be problems in Opera 7. The page looks
    > like there is allocated space for an applet. Printing the size of the
    > document.applets array return as expected 0 before the insertion, and 1
    > after, in both Opera 7 and IE. However, the applet does not init properly
    > (no painting).
    >
    > Anyone?
    >
    > Regards Tormod Omholt-Jensen
    >
    >
    > ------------------- C O D E -----------------
    >
    > <script language="JavaScript1.2">
    >
    > var applet = document.createElement("applet");
    > applet.code = "MyApplet.class";
    > applet.height = "50";
    > applet.width = "50";
    > applet.defer = true;
    >
    > document.body.appendChild(applet);
    >
    > </script>


    Wild guess here: To correctly start an applet, two methods are called
    automatically by the browser: init() and start().

    init() is called once only, when the applet is created.
    start() is called every time that the applet is started, for example
    when the page is reloaded.

    These two methods can be overloaded by your own applet. I suspect that
    they are called in IE but not in Opera. What you can do is overload
    init() and start() so that a message is sent to the Java console when
    they are executed. Like this you can check if they are called correctly.

    HTH,

    Laurent
    --
    Laurent Bugnion, GalaSoft
    Webdesign, Java, JavaScript: http://www.galasoft-LB.ch
    Private/Malaysia: http://mypage.bluewin.ch/lbugnion
    Support children in Calcutta: http://www.calcutta-espoir.ch
     
    Laurent Bugnion, GalaSoft, Sep 18, 2003
    #2
    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. zorhel
    Replies:
    0
    Views:
    330
    zorhel
    Aug 24, 2004
  2. Bob
    Replies:
    24
    Views:
    1,546
  3. zorhel
    Replies:
    0
    Views:
    124
    zorhel
    Aug 24, 2004
  4. zorhel
    Replies:
    0
    Views:
    128
    zorhel
    Aug 24, 2004
  5. kie
    Replies:
    25
    Views:
    260
Loading...

Share This Page