Solved

Javascript calling applet function

Posted on 2002-03-13
4
181 Views
Last Modified: 2012-05-04
Here is my HTML code:

<html>
     <head>
     </head>
<script language="javascript">
     function openVideo(){
     document.myapplet.displayURL("http://www.google.com");
     }
</script>
<body>
<a href="" onClick="openVideo();"> open video </a> <br>

<script language="javascript">
document.write("<APPLET CODE=\"com.package.MyApplet\" NAME=\"myapplet\" WIDTH = \""+width+"\" HEIGHT =
\""+height+"\" ARCHIVE = \"code.jar\" MAYSCRIPT>");
document.write("</APPLET>");
</script>

</body>

My Applet has a public function:
public void displayURL(String url);
However when I run this page, I get an error:"Object doesn't support this property or method". The line cause this error is:
document.myapplet.displayURL("http://www.google.com");
I'm using IE 6.0.2600.
I tried <Object ID=...> but the same thing happens.
0
Comment
Question by:daitt
  • 2
  • 2
4 Comments
 
LVL 3

Author Comment

by:daitt
Comment Utility
I removed some variables for you to easier to read, so you might wonder what is width and height.
width=640;
height=480;
0
 
LVL 30

Accepted Solution

by:
third earned 50 total points
Comment Utility
0
 
LVL 3

Author Comment

by:daitt
Comment Utility
I checked again and found out that after my applet is processed by DashO, the function is renamed. I uncheck the renaming for that function and now the javascript can call that function.
I accept third's comment because after I got the applet from the site and after stripping all the redundant code, I have a version that works. It proves that my code is ok and the problem must be somewhere else.
0
 
LVL 30

Expert Comment

by:third
Comment Utility
actually, i haven't got a clue on your problem and accidentally i found this page. it came to my mind that the problem might come on tha java code itself but i wasn't sure so i just directed you to the link for you to find out. ;-)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now