Interaction with javascript
Im using JSObject to call a function in my html file, but its not working. Can you tell me why?
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
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>
Re: Interaction with javascript
Maybe because playSong isn't playSound?
db