HawHaw! :mryellow:

Something I played with just for the fun of it, even though I have no personal use for it - Someone may like it? :P

Here, I've used Chat as an example - But it could be any or all Submit Buttons if you are adventurous enough to add it anywhere you wish - So don't ask me how one applies it to "Other" Submit Buttons - You will have to find them and work that out yourself. ;)

However, the Javascript does allow one to play any sound for any button - Just change the .wav and anchor string for any particular sound you want to use wherever there is a "Submit" string? And for this - You WILL have to save the javascript to a .js file and "Call" it with a <src=string in the appropriate header.tpl file rather than add it to the ajax_shoutbox_js.tpl.

Code:

Copy bark.wav to the root of your forum.


GoTo root/templates/default

Code: [Download] [Hide] [Select]
Open: ajax_shoutbox_body.tpl

Find:

<input type="submit" class="button" id="submit" name="submit" value="{L_SUMBIT}" />

Replace with:

<input type="submit" class="button" id="submit" name="submit" value="{L_SUMBIT}" onclick='play("bark.wav",false)'; />

Open: ajax_shoutbox_js.tpl

At the bottom find: //-->

Before Add:

/*
__ __
/\ \ __ /\ \
___ ___ __ \_\ \ __ __ __/\_\ ____ __ _ __ \_\ \ ____
/' __` __`\ /'__`\ /'_` \ /\ \/\ \/\ \/\ \/\_ ,`\ /'__`\ /\`'__\/'_` \ /',__\
/\ \/\ \/\ \/\ \_\.\_/\ \_\ \ \ \ \_/ \_/ \ \ \/_/ /_/\ \_\.\_\ \ \//\ \_\ \/\__, `\
\ \_\ \_\ \_\ \__/.\_\ \___,_\ \ \___ยค___/'\ \_\/\____\ \__/.\_\ \_\ \___,_\/\____/
\/_/\/_/\/_/\/__/\/_/\/__,_ / \/__//__/ \/_/\/____/\/__/\/_/ \/_/ \/__,_ /\/___/
<======[http://MadWizards.net]========[Code:Vidar Larsen 2006]====[http://softnice.net]=======>


--------------------------------[start]-------------------------------------- */

ns6 = document.getElementById;
ns = document.layers;
ie = document.all;

//========================[Sound variables - checking for sound] ===================================//
var NSsound = navigator.plugins && navigator.plugins["LiveAudio"];
var IEsound = navigator.plugins && document.all;
var audioEnabled = NSsound || IEsound;

function newContent(layernm,content) {
if (ns6) document.getElementById(layernm).innerHTML=content;
else if (ie) document.all[layernm].innerHTML=content;
else if (ns) {
eval(' document.layers["'+layernm+'"].document.open();');
eval(" document.layers['"+layernm+"'].document.write('"+content+"');");
eval(' document.layers["'+layernm+'"].document.close();');
}
}

//========[crossbrowser init sound]==============//
function makeSoundDiv(soundname,newInnerHTML) {
var oDiv = document.createElement ("DIV");
oDiv.id = soundname;
oDiv.style.position = "absolute";

oDiv.innerHTML=newInnerHTML;
document.body.appendChild (oDiv);
delete oDiv; }
//==================================[crossbrowser init sound]========================================//
function init(soundfile,autostart,loopit) {
soundname=soundfile;
var buff='';
if (loopit==null) loopit=false;
if (audioEnabled) {
if (autostart==null) autostart=false;
buff+='<embed name="obj_'+soundname+'" src='+soundfile+' autoplay="'+autostart+'" AUTOSTART="'+autostart+'" loop="'+loopit+'" hidden="true" volume="80%" > ';
buff+='<NOEMBED><BGSOUND src='+soundfile+'></NOEMBED>';
buff+='</embed> ';
} else { // try something else
if (autostart==true) autostart=1; else autostart=0;
if (loopit==true) loopit=1; else loopit=0;
buff+='<object type="application/x-mplayer2" ';
buff+=' pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" ';
buff+=' Name="obj_'+soundname+'" src='+soundfile+' AutoStart='+autostart+' ShowStatusBar=1 volume=-1 loop='+loopit+' >';
buff+=' </object> ';
}
makeSoundDiv(soundname,buff);
makeSoundDiv(soundname+"_buffer",buff);
}


function play(soundname,loopit) {
if (document.getElementById(soundname)) newContent(soundname,document.getElementById(soundname+"_buffer").innerHTML);
else init(soundname,true,loopit);
}


/*
all you need is to write play("your_sound_file.midi",true); for loop
or play("your_sound_file.midi",false); for one time play
You do not have to use the init(...) function since it is called from the play(...) function
This script has been tested and work with Internet Explorer, FireFox and Netscape


*/


Change the bark.wav to anything your heart desires - - - - - :LOL: