Hello, I have been having this problem. I am trying to get this function to work. What its suppose to do is play a sound without and event handler(onclick, onload) just trying to call the function. I used Error Console to try and help me, all I got from that is ‘Error calling method NPObject! Line 9’ Line 9 is this code: soundLogout.Play();
Here is the rest of my code:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “
<html xmlns=”
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
<script type=”text/javascript”>
function playSound(logoutSound) {
var soundLogout=document.getElementById(logoutSound);
soundLogout.Play();
}
</script>
</head>
<body>
<embed src=”logout.wav” autostart=”false” id=”logout” enablejavascript=”true”/>
<script type=”text/javascript” language=”javascript”>
if(document.getElementById(‘logout’)){
playSound(‘logout’);
}
</script>
</body>
</html>
One thing I noticed, if you put an alert message inbeween the variable line and the Play() inside the function it works! but then I have an alert message (which i dont want), that code looks like:
<script type=”text/javascript”>
function playSound(logoutSound) {
var soundLogout=document.getElementById(logoutSound);
alert(logoutSound);
soundLogout.Play();
}
</script>
Any Help would be awesome Thanks