Results 1 to 2 of 2
  1. #1
    rasen58 is offline Member
    Join Date
    Oct 2012
    Posts
    15
    Rep Power
    0

    Default Interaction with javascript

    Im using JSObject to call a function in my html file, but its not working. Can you tell me why?
    Java Code:
    public class birthday extends JApplet implements ActionListener
    {
    ...
    public void actionPerformed(ActionEvent evt) {
    		
    if(evt.getSource() == song1)
    			{
    				JSObject win = JSObject.getWindow(this);
    				win.call("playSong", null);
    }
    }
    html file
    XML Code:
    <!DOCTYPE html>
    <html>
    <head> 
    
    <script type="text/javascript">
    	function playSound()
    	{
    		document.getElementById("sound").play();	
    	}
    </script>
    </head>
    
    <body>
    
    <applet code="birthday.class" width= 100% height=700 MAYSCRIPT> </applet>
    <audio src="New Divide.wav" id="sound" preload="auto"></audio>
    </body>
    </html>

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: Interaction with javascript

    Maybe because playSong isn't playSound?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. want help about ArrayList and interaction
    By chmo in forum New To Java
    Replies: 2
    Last Post: 11-03-2010, 01:45 PM
  2. GUI interaction
    By Glyph in forum New To Java
    Replies: 6
    Last Post: 10-19-2010, 07:43 PM
  3. Java interaction
    By satimis in forum New To Java
    Replies: 4
    Last Post: 06-30-2010, 05:14 PM
  4. program interaction possible?
    By Pierced1 in forum Advanced Java
    Replies: 3
    Last Post: 02-19-2009, 12:54 AM
  5. Object Interaction
    By Jinxes in forum New To Java
    Replies: 1
    Last Post: 12-03-2007, 12:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •