jaytaylor Posted November 19, 2005 Share Posted November 19, 2005 I am running a shoutboard on my home page. How would I add sound when a person hits the enter key or send button? I want the receiving party to hear the sound file on their side. I just want to use a little ding wave. Quote Link to comment Share on other sites More sharing options...
moberemk Posted November 21, 2005 Share Posted November 21, 2005 Try addinga Javascript onSubmit property to your form that plays a sound. As for what happens when you press enter, don't look at me. Quote Link to comment Share on other sites More sharing options...
jaytaylor Posted November 22, 2005 Author Share Posted November 22, 2005 [!--quoteo(post=320562:date=Nov 20 2005, 08:15 PM:name=moberemk)--][div class=\'quotetop\']QUOTE(moberemk @ Nov 20 2005, 08:15 PM) 320562[/snapback][/div][div class=\'quotemain\'][!--quotec--] Try addinga Javascript onSubmit property to your form that plays a sound. As for what happens when you press enter, don't look at me. This is the a part of the index.php I have to work with. Where and how would I use that function? I am learning this as I go. Thanks to anyone who helps me out. ..... <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript"> <!-- function TAG_Pop(URL, WID, HEI) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=" + WID + ",height=" + HEI + "');"); } function tagSubmit() { document.tagger.message.focus(); document.tagger.comment.value = document.tagger.message.value; document.tagger.message.value = ''; } </script> </head> <body> <form action="sign.php" name="tagger" method="get" onsubmit="javascript: tagSubmit();" target="tags"> <div id="tagFrame"> <iframe class="tagsFrame" src="tags.php?show=limit&skin=<?=$_GET['skin']?>" name="tags" frameborder="0" scrolling="yes"> Sorry, you need inline frames to fully see this page. </iframe> </div> <?php if ($_COOKIE['data']['name']) $input[name] = $_COOKIE['data']['name']; else $input[name] = "name"; if ($_COOKIE['data']['mail']) $input[mail] = $_COOKIE['data']['mail']; else $input[mail] = "http://"; ?> <div id="inputFrame"> <input type="hidden" name="style" value="<?=$_GET['skin']?>" /> <input type="hidden" name="comment" value="" /> <div class="inputBox"> <div align="center"><br> </div> <div align="center"> <input type="text" size="25" name="name" value="<?=$input[name]?>" class="input" maxlength="22" /> </div> </div> <div class="inputBox"> <div align="center"> <input type="text" size="100" name="message" value="" class="input" maxlength="1500" /> <span class="inputSBox"> <input type="submit" value=" send " class="button" /> </span> <span class="inputSBox"> </span></div> </div> <div class="inputSBox"></div> <div class="textBox"> <div align="center"> </div> </div> </form> ........ Quote Link to comment Share on other sites More sharing options...
moberemk Posted November 22, 2005 Share Posted November 22, 2005 Well, since you seem to be using Dreamweaver (otherwise, why would you be posting here?) so I'll have to assume that you know how to do this. You need to select the form, and go under the Tag Inspector panel. You then click the Behaviors panel. In there, there should be a white space. You need to select the right column and choose "onSubmit" and then click inside the left column. You then click on the little + symbol button and select the "Play Sound" option. From there, it should be rather straightforward. Outisde of Dreamweaver, I can't really help you. Quote Link to comment Share on other sites More sharing options...
jaytaylor Posted November 23, 2005 Author Share Posted November 23, 2005 [!--quoteo(post=321055:date=Nov 22 2005, 07:09 AM:name=moberemk)--][div class=\'quotetop\']QUOTE(moberemk @ Nov 22 2005, 07:09 AM) 321055[/snapback][/div][div class=\'quotemain\'][!--quotec--] Well, since you seem to be using Dreamweaver (otherwise, why would you be posting here?) so I'll have to assume that you know how to do this. You need to select the form, and go under the Tag Inspector panel. You then click the Behaviors panel. In there, there should be a white space. You need to select the right column and choose "onSubmit" and then click inside the left column. You then click on the little + symbol button and select the "Play Sound" option. From there, it should be rather straightforward. Outisde of Dreamweaver, I can't really help you. That works on my side. I hear the sound but the receiver doesn't hear the sound. It also works when I press the enter button which is what I wanted. "What do I need to do for you to hear the sound file when I am sending you a message on my shout board?" Thanks for your help. Quote Link to comment Share on other sites More sharing options...
moberemk Posted November 23, 2005 Share Posted November 23, 2005 What kind of sound is it though? MP3 is the best for this kind of stuff. Quote Link to comment Share on other sites More sharing options...
jaytaylor Posted November 23, 2005 Author Share Posted November 23, 2005 I did it with MP3. Same deal. I hear it when I click submit but the other computer doesn't her the noise when the message comes through on his computer. Quote Link to comment Share on other sites More sharing options...
moberemk Posted November 24, 2005 Share Posted November 24, 2005 Is it isolated? Is it heard on other computers? Give us some more info here! Quote Link to comment Share on other sites More sharing options...
jaytaylor Posted November 24, 2005 Author Share Posted November 24, 2005 I inserted the Java onSubmit function and added the mp3 ring. After I did this I uploaded the new index.php to my web host. When I typed the message I heard the little ding mp3 (I also did this with the wav file) My buddy who works on the web site with me who lives 8,000 mile away from me heard it when he submits his message. {I currently have the old index.php back at my site. After we tested it we just changed it back to the origional} What we want to do is make it more like an instant messenger where when I type a message he can here the noise come through his PC. I don't care to here a sound when I submit the message from my side. I just want everyone else to hear it come through. Basically when my tags (messages) are updated I want the sound to come through on the users pc. Maybe I am trying to work with the wrong page. I am unsure. I just want to know how to make the tagboard make a sound when it updates? Quote Link to comment Share on other sites More sharing options...
djmels Posted November 25, 2005 Share Posted November 25, 2005 What you want is *impossible* with just HTML/Javascript and PHP. Any user can request a page from the PHP server, but the server is *not* capable of sending anything on a random cue to the user's browser. Hence, you could only make a sound play when there's a new message and the user *happens to* refresh the page. Otherwise, I'd go for a Flash or Java (not Javascript but real Java!) chatbox application. They communicate directly and can receive anything at any time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.