• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Help!!- Not able to an Applet method from javascipt - throws error "not a function"

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a newbie to javascript and applets. I am stuck with a problem with javascript in netscape 7.0 version(works fine in IE and netscape 4.x) and it would be great if could give me some pointers regarding this.
Let me explain the problem :
I am accessing some functions of an applet in my javascript code as "document.myApplet.Appletfunction()" and this sometimes does not work at all and throws the following javascript error in the Netscape JavaScript Console in 7.0.
"document.StartTimeControl.hasValue() is not a function".( But the function is defined in the applet.)
However this problem is inconsistent and everything works smoothly at times.
I am using java 1.4.2 with the appropriate jpi plugin.

The html code looks like this
--------------------------------
& lt;BODY onlod="init()"& lt;
& lt;SCRIPT LANGUAGE="JavaScript"& lt;
& lt;!-- Begin
function init()
{
if (document.StartTimeControl.hasValue() == false)
{
document.StartTimeControl.setTime(document.formLogfileSearch.StartTime.value);
document.EndTimeControl.setTime(document.formLogfileSearch.EndTime.value);
document.StartDateControl.setDate(document.formLogfileSearch.StartMonth.value,
document.formLogfileSearch.StartDay.value,
document.formLogfileSearch.StartYear.value);
document.EndDateControl.setDate(document.formLogfileSearch.EndMonth.value,
document.formLogfileSearch.EndDay.value,
document.formLogfileSearch.EndYear.value);
}
parent.menu.activate_log_button();
}
// End --& lt;
& lt;/SCRIPT& lt;

.
.
& lt;TABLE CELLPADDING="0" CELLSPACING="0" BORDER="1" WIDTH="96%" rules="none"& lt;
& lt;TR& lt;& lt;TD& lt;
& lt;table border="0" CELLPADDING="0" CELLSPACING="0" width="100%"& lt;
& lt;tr& lt;
& lt;TD& lt;
& lt;APPLET CODE = "MyApplet.class" NAME="MyApplet"
WIDTH="100" HEIGHT="24" ARCHIVE="/myapp/myapplet.jar"& lt;
& lt;/APPLET& lt;
& lt;INPUT TYPE="HIDDEN" NAME="StartTime" VALUE="00:00:00"& lt;
& lt;/td& lt;
& lt;/tr& lt;
& lt;TR& lt;
& lt;TD& lt;
& lt;APPLET CODE = "TimeApplet.class" NAME="EndTimeControl"
WIDTH="100" HEIGHT="24" ARCHIVE="myapplet.jar"& lt;
& lt;/APPLET& lt; 
& lt;INPUT TYPE="HIDDEN" NAME="EndTime" VALUE="23:59:59"& lt;
& lt;/td& lt;
-----------------------------------------------------------------------
Tried with Object Tags and passing "mayscript" param to applet. But this did not work..Can anybody please help!!!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using the Applet tag, use a combo of the <object> and <embed> tag in your html to load up your applet. Sun has an applet converter tool that will change your applet tag code to the correct code using the object and embed tags.
Afterwards, in Netscape 7.0, look to document.embeds[0] array to find your applet. In IE - you will find your applet installed on the document.applets[0] array. To make sure your applet got loaded properly, do a check of the .length of the arrays....

If both of these are zero's, then your applet isn't loaded ....
Hope this helps,
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic