Jump to content

Adding sound to shoutbox/tagboard


Recommended Posts

[!--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>

 

........

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

[!--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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.