Unable to call Applet methods in Firefox while its display is set to 'none'.
Deepika Kakrania
Greenhorn
Joined: Mar 21, 2006
Posts: 2
posted
0
Hi,
I am having a weird problem. I am using javascript to call Applet methods. Everything works fine (in both Firefox and IE) if the display of its containing DIV is set to 'block' (i.e., style.display='block') but problem happens in Firefox when I set the display to 'none' and try to call Applet's method(sendData()). It gives below error. (where 'test_1' is the name of the applet)
Error: document.test_1.sendData is not a function
In summary this is the sequence that is followed: 1) set the containing DIV's display to 'block' in html page. 2) change the display to 'none' in 'onload' event. 3) call document.test_1.sendData() 4) set the display to 'block'.
It works fine in IE without any issue. Seems to me that setting style.display to 'block'/'none' works differently 2 browsers (IE and Firefox). in IE, it keeps
In IE, sendData()(step 3) works fine even though display is set to 'none'(step 2) and applet shows the data passed to it via 'sendData()' after setp 4 but in Firefox, it seems to unload the applet in step 2 and re-load it in step 4.
Does anyone know if there is way to fix this problem so that I can call sendData() even when applet is not displayed on the page. I tried with setting style.Visibility to 'hidden' but that doesn't solve my problem as it still takes the space on the web page.
Any help is appreciated.
Thanks, Deepika
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35237
7
posted
0
I'm not sure if this is the cause of your problem, but there have been problems with the interaction of display='none' and appletsbefore and now.
If you want the applet not to be visible, have you tried setting its size to 0/0 or 1/1?
But how can I change the size of applet dynamically? Seems Calling "document.myApplet.setSize( w_newWidth, w_newHeight );" from Javascript does resize the applet. However, it does not resize the area that is occupied by the applet.