Jump to content


Photo

Adding sound to shoutbox/tagboard


  • Please log in to reply
9 replies to this topic

#1 jaytaylor

jaytaylor
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 19 November 2005 - 11:58 PM

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.

#2 moberemk

moberemk
  • Members
  • PipPipPip
  • Advanced Member
  • 695 posts

Posted 21 November 2005 - 01:15 AM

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.
Disclaimer: No matter how harsh I may be, I'm always IMO only.

#3 jaytaylor

jaytaylor
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 22 November 2005 - 04:21 AM

[!--quoteo(post=320562:date=Nov 20 2005, 08:15 PM:name=moberemk)--][div class=\'quotetop\']QUOTE(moberemk @ Nov 20 2005, 08:15 PM) View Post[/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.
[/quote]

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>

........

#4 moberemk

moberemk
  • Members
  • PipPipPip
  • Advanced Member
  • 695 posts

Posted 22 November 2005 - 12:09 PM

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.
Disclaimer: No matter how harsh I may be, I'm always IMO only.

#5 jaytaylor

jaytaylor
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 23 November 2005 - 05:22 AM

[!--quoteo(post=321055:date=Nov 22 2005, 07:09 AM:name=moberemk)--][div class=\'quotetop\']QUOTE(moberemk @ Nov 22 2005, 07:09 AM) View Post[/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.
[/quote]

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.

#6 moberemk

moberemk
  • Members
  • PipPipPip
  • Advanced Member
  • 695 posts

Posted 23 November 2005 - 04:20 PM

What kind of sound is it though? MP3 is the best for this kind of stuff.
Disclaimer: No matter how harsh I may be, I'm always IMO only.

#7 jaytaylor

jaytaylor
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 23 November 2005 - 04:40 PM

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.

#8 moberemk

moberemk
  • Members
  • PipPipPip
  • Advanced Member
  • 695 posts

Posted 24 November 2005 - 06:42 PM

Is it isolated? Is it heard on other computers? Give us some more info here!
Disclaimer: No matter how harsh I may be, I'm always IMO only.

#9 jaytaylor

jaytaylor
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 24 November 2005 - 11:07 PM

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?

#10 djmels

djmels
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 25 November 2005 - 09:58 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users