Solved

Javascript calling applet function

Posted on 2002-03-13
4
183 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
ID: 6863601
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
ID: 6863614
0
 
LVL 3

Author Comment

by:daitt
ID: 6863918
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
ID: 6863938
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

856 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