Redkaven
08-02-2003, 09:51 PM
Here are the 2 scripts:
--------------------------------
First Script
--------------------------------
<script type="text/javascript">
/************************************************** **
* DOM Image rollover:
* by Chris Poole
* http://chrispoole.com
* Script featured on http://www.dynamicdrive.com
* Keep this notice intact to use it :-)
************************************************** **/
function init() {
if (!document.getElementById) return
var imgOriginSrc;
var imgTemp = new Array();
var imgarr = document.getElementsByTagName('img');
for (var i = 0; i < imgarr.length; i++) {
if (imgarr[i].getAttribute('hsrc')) {
imgTemp[i] = new Image();
imgTemp[i].src = imgarr[i].getAttribute('hsrc');
imgarr[i].onmouseover = function() {
imgOriginSrc = this.getAttribute('src');
this.setAttribute('src',this.getAttribute('hsrc'))
}
imgarr[i].onmouseout = function() {
this.setAttribute('src',imgOriginSrc)
}
}
}
}
onload=init;
</script>
------------------------------------------------
Second Script
------------------------------------------------
<BGSOUND ID="auIEEmb">
<SCRIPT><!--
// MouseOver/MouseClick audio.
// by JS Archive - http://jsarchive.8m.com
var ayAudio = new Array();
// Source for sound files to be preloaded
ayAudio[0] = "aartmusic_laugh2.wav";
ayAudio[1] = "Ding.wav";
function AudioCheck() {
var n = navigator.appName
if (n=="Netscape") this.ns = true;
else if (n=="Microsoft Internet Explorer" && document.all) this.ie = true;
else this.noAudio = true;
}
onload = function() {
is = new AudioCheck()
if (is.noAudio) return;
var s = '';
for (i=0; i<ayAudio.length; i++)
s += "<EMBED SRC='"+ayAudio[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (is.ns) {
auEmb = new Layer(0);
with (auEmb.document) { open();write(s);close() };
}
else document.body.insertAdjacentHTML("BeforeEnd",s);
auCon = is.ns? auEmb.document.embeds:auIEEmb;
auCon.ctrl = function(au,play) {
if (is.ie) this.src = play? ayAudio[au]:'';
else eval( "this[au]." + (play? "play()":"stop()") );
}
is.auDone = true;
}
function playAudio(whAu) { if (window.auCon) auCon.ctrl(whAu,1) }
function stopAudio(whAu) { if (window.auCon) auCon.ctrl(whAu,0) }
//--></SCRIPT>
----------------------------------------------
Here is the body Onload code I'm using:
<BODY BGCOLOR="#000000" TEXT="#000000" onload="init(); audiocheck();">
What am I doing wrong? I cannot get both scripts to run...
Thanks,
-Redkaven
--------------------------------
First Script
--------------------------------
<script type="text/javascript">
/************************************************** **
* DOM Image rollover:
* by Chris Poole
* http://chrispoole.com
* Script featured on http://www.dynamicdrive.com
* Keep this notice intact to use it :-)
************************************************** **/
function init() {
if (!document.getElementById) return
var imgOriginSrc;
var imgTemp = new Array();
var imgarr = document.getElementsByTagName('img');
for (var i = 0; i < imgarr.length; i++) {
if (imgarr[i].getAttribute('hsrc')) {
imgTemp[i] = new Image();
imgTemp[i].src = imgarr[i].getAttribute('hsrc');
imgarr[i].onmouseover = function() {
imgOriginSrc = this.getAttribute('src');
this.setAttribute('src',this.getAttribute('hsrc'))
}
imgarr[i].onmouseout = function() {
this.setAttribute('src',imgOriginSrc)
}
}
}
}
onload=init;
</script>
------------------------------------------------
Second Script
------------------------------------------------
<BGSOUND ID="auIEEmb">
<SCRIPT><!--
// MouseOver/MouseClick audio.
// by JS Archive - http://jsarchive.8m.com
var ayAudio = new Array();
// Source for sound files to be preloaded
ayAudio[0] = "aartmusic_laugh2.wav";
ayAudio[1] = "Ding.wav";
function AudioCheck() {
var n = navigator.appName
if (n=="Netscape") this.ns = true;
else if (n=="Microsoft Internet Explorer" && document.all) this.ie = true;
else this.noAudio = true;
}
onload = function() {
is = new AudioCheck()
if (is.noAudio) return;
var s = '';
for (i=0; i<ayAudio.length; i++)
s += "<EMBED SRC='"+ayAudio[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (is.ns) {
auEmb = new Layer(0);
with (auEmb.document) { open();write(s);close() };
}
else document.body.insertAdjacentHTML("BeforeEnd",s);
auCon = is.ns? auEmb.document.embeds:auIEEmb;
auCon.ctrl = function(au,play) {
if (is.ie) this.src = play? ayAudio[au]:'';
else eval( "this[au]." + (play? "play()":"stop()") );
}
is.auDone = true;
}
function playAudio(whAu) { if (window.auCon) auCon.ctrl(whAu,1) }
function stopAudio(whAu) { if (window.auCon) auCon.ctrl(whAu,0) }
//--></SCRIPT>
----------------------------------------------
Here is the body Onload code I'm using:
<BODY BGCOLOR="#000000" TEXT="#000000" onload="init(); audiocheck();">
What am I doing wrong? I cannot get both scripts to run...
Thanks,
-Redkaven