Solved

Javascript calling applet function

Posted on 2002-03-13
4
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

688 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