Roxxie
11-10-2004, 12:07 PM
I'm not a programmer but I have a question about combining 2 scripts. I have a script for creating a popup window and I have it working just fine, now I want to add a click sound to the icon so when someone moves the cursor over the icon it makes a sound (click) before or while the window is opening. If someone could take the time to explain what has to be done. I know both part 1's go in the head. how do I put the 2 part 2's together, or is it done another way. Is there a script somewhere that already does this, I've looked but no luck. Thanks for your time.
The scripts come from A1 Javascripts Resources.
This is the script for the sound, mouseoversound.zip
2 parts to this script
===============================================
part 1
===============================================
<BGSOUND ID="auIEContainer">
<SCRIPT LANGUAGE="JavaScript"><!--
// Preload and play audio files with event handler (MouseOver sound)
// designed by JavaScript Archive, (c)1999
// Get more free javascripts at http://jsarchive.8m.com
var aySound = new Array();
// Below: source for sound files to be preloaded
aySound[0] = "Chimes.wav";
aySound[1] = "Ding.wav";
// DO NOT edit below this line
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.auIEContainer: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>
==============================================
part 2
==============================================
place withen your link: onMouseOver="playSound(0)" onMouseOut="stopSound(0)"
EXAMPLE
------------
[/url]
This is the script for the popup. popuponmo.zip
2 parts to this script
=======================================
part 1 - place in the head
======================================
<script language="JavaScript">
//script by [url]www.a1javascripts.com (YourPage.html)
<!--
function openWin( windowURL, windowName, windowFeatures ) {
return window.open( windowURL, windowName, windowFeatures ) ;
}
// -->
</script>
================================================================
part 2 - place where you want your link to show
YOUR-LINK (javascript:void())
The scripts come from A1 Javascripts Resources.
This is the script for the sound, mouseoversound.zip
2 parts to this script
===============================================
part 1
===============================================
<BGSOUND ID="auIEContainer">
<SCRIPT LANGUAGE="JavaScript"><!--
// Preload and play audio files with event handler (MouseOver sound)
// designed by JavaScript Archive, (c)1999
// Get more free javascripts at http://jsarchive.8m.com
var aySound = new Array();
// Below: source for sound files to be preloaded
aySound[0] = "Chimes.wav";
aySound[1] = "Ding.wav";
// DO NOT edit below this line
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.auIEContainer: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>
==============================================
part 2
==============================================
place withen your link: onMouseOver="playSound(0)" onMouseOut="stopSound(0)"
EXAMPLE
------------
[/url]
This is the script for the popup. popuponmo.zip
2 parts to this script
=======================================
part 1 - place in the head
======================================
<script language="JavaScript">
//script by [url]www.a1javascripts.com (YourPage.html)
<!--
function openWin( windowURL, windowName, windowFeatures ) {
return window.open( windowURL, windowName, windowFeatures ) ;
}
// -->
</script>
================================================================
part 2 - place where you want your link to show
YOUR-LINK (javascript:void())