PDA

View Full Version : Can someone help me with this script?



crood58
10-23-2009, 01:37 PM
I have this script


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript">
var theSound = "on";
function playSound(){
if(document.getElementById("mute").checked == false){
document.getElementById("theSound").style.display = "block"; //isert play sound code here
}
}
function muteSound(){
document.getElementById("theSound").style.display = "none"; //insert stop sound code here
}
</script>
</head>

<body>
<form name="soundTest">
<input name="sound" type="checkbox" value="on" id="mute" />Mute
</form>
<p onmouseover="playSound()" onmouseout="muteSound()">Mouseover this to make the "Sound".</p>
<!--This is just a div that represents a sound playing.-->
<div id="theSound" style="display:none; background:#FF0000; padding:10px; font-size:36px">SOUND!</div>
</body>
</html>

There will be actually two div's that will show on the mouse click (Not using mouseover) the one will show the audio is on and the other will show if the audio is off. If someone could verify that for me that would be great. I am really looking for a javascript that I can insert in the script to by the sound and one to stop the sound. I probably will have two different sound files for different mouse clicks. I also would rather uses the embed command in html to insert the sound file and call by a defined name within that tag. maybe instead of using the checkbox I can use two form buttons one will be on and the other will be off. How can I modify the script to do this?

Can anyone help with this? Thank you in advance for your help. I have been trying to get this done for awhile now.

Chris