You are here: Re: yet anohter sound mouse over question « HTML « IT news, forums, messages
Re: yet anohter sound mouse over question

Posted by Andrew Bailey on 06/21/06 08:35

Hi Kryss,


Here is the script...

<!-- --><bgsound id="soundfiles">
<script language="JavaScript"><!--
var aySound = new Array();

aySound[0] = "../audio/select.wav";
aySound[1] = "../audio/click.wav";

IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
ver4 = IE||NS? 1:0;
onload=auPreload;
function auPreload() {
if (!ver4) return;
if (NS) auEmb = new Layer(0,window);
else {
Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
document.body.insertAdjacentHTML("BeforeEnd",Str);
}
var Str = '';
for (i=0;i<aySound.length;i++)
Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (IE) auEmb.innerHTML = Str;
else {
auEmb.document.open();
auEmb.document.write(Str);
auEmb.document.close();
}
auCon = IE? document.all.soundfiles:auEmb;
auCon.control = auCtrl;
}
function auCtrl(whSound,play) {
if (IE) this.src = play? aySound[whSound]:'';
else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
}
function playSound(whSound) { if (window.auCon)
auCon.control(whSound,true); }
function stopSound(whSound) { if (window.auCon)
auCon.control(whSound,false); }
//--></script>

....and here is the call...

<a href="newpage.html" onMouseOver="playSound(0)"
onMousedown="playSound(1)">BUTTON</a>

Hope that helps

Andy



"Kryss" <kryss7@gmail.com> wrote in message
news:1150860483.969295.85750@m73g2000cwd.googlegroups.com...
>I am trying to create a mouse over with a static gif, an animated gif
> and a wav or mp3
> per my clients request
>
> I can get te image mouseover, but not the sound.
>
> http://thewargame.com/working/game.htm
>
> Any suggestions are appreciated. At the moment i simply have the mouse
> over image up without the sound
> Regards,
> Kryss
>
> PS oh and it would be nice to be cross browser compliant (those are his
> words)
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация