I placed an image button on my ASP page that uses some javascript in a mouseover event. I was able to modify the code and the onclick event worked as expected.
The problem I'm having has to do with placing another button on the page. At first I used the same script file and although the onclick event works fine on both buttons. The mouse over event does not. I don't get an error, they just don't work. I know it has to do with the onload event in the html Body tag so I copied the include file and modified the function by giving it a new name because I figured it was a conflict trying to load two differnt values into the same variables at onload. However, creating a modified copy didn't work either.
Both includes files and their corresponding buttons work fine when placed seperatley on the page, but when both buttons are placed on the page, the onclick works but the mouseover events that change the images do not.
What am I missing? Here is the code from one of the files I am using.
<HTML>
<HEAD>
<!---Use This File For Data Entry Button Off CTSFrontEnd.ASP--->
<SCRIPT TYPE="text/javascript">
<!--
function newImg(arg) {
if (document.images) {
rslt1 = new Image1();
rslt1.src = arg1;
return rslt1;
}
}
function changeImages1() {
if (document.images && (preloadFlag1 == true)) {
for (var i=0; i<changeImages1.arguments.length; i+=2) {
document[changeImages1.arguments].src = changeImages1.arguments[i+1];
}
}
}
var preloadFlag1 = false;
function preloadImages1() {
if (document.images) {
on = newImg("graphics/DEon.gif");
preloadFlag1 = true;
}
}
// -->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" ONLOAD="preloadImages1();">
<p>
<!--- this is the start of the button image information --->
<A HREF="#" onClick="parent.location=' ONMOUSEOVER="changeImages1('off', 'graphics/DEon.gif'); return true;" ONMOUSEOUT="changeImages1('off', 'graphics/DEoff.gif'); return true;">
<IMG NAME="off" SRC="graphics/DEoff.gif" BORDER="0" ALT=""></A>
<!--- this is the end of the button image information --->
</p>
<p>
</p>
</BODY>
</HTML>
The problem I'm having has to do with placing another button on the page. At first I used the same script file and although the onclick event works fine on both buttons. The mouse over event does not. I don't get an error, they just don't work. I know it has to do with the onload event in the html Body tag so I copied the include file and modified the function by giving it a new name because I figured it was a conflict trying to load two differnt values into the same variables at onload. However, creating a modified copy didn't work either.
Both includes files and their corresponding buttons work fine when placed seperatley on the page, but when both buttons are placed on the page, the onclick works but the mouseover events that change the images do not.
What am I missing? Here is the code from one of the files I am using.
<HTML>
<HEAD>
<!---Use This File For Data Entry Button Off CTSFrontEnd.ASP--->
<SCRIPT TYPE="text/javascript">
<!--
function newImg(arg) {
if (document.images) {
rslt1 = new Image1();
rslt1.src = arg1;
return rslt1;
}
}
function changeImages1() {
if (document.images && (preloadFlag1 == true)) {
for (var i=0; i<changeImages1.arguments.length; i+=2) {
document[changeImages1.arguments].src = changeImages1.arguments[i+1];
}
}
}
var preloadFlag1 = false;
function preloadImages1() {
if (document.images) {
on = newImg("graphics/DEon.gif");
preloadFlag1 = true;
}
}
// -->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" ONLOAD="preloadImages1();">
<p>
<!--- this is the start of the button image information --->
<A HREF="#" onClick="parent.location=' ONMOUSEOVER="changeImages1('off', 'graphics/DEon.gif'); return true;" ONMOUSEOUT="changeImages1('off', 'graphics/DEoff.gif'); return true;">
<IMG NAME="off" SRC="graphics/DEoff.gif" BORDER="0" ALT=""></A>
<!--- this is the end of the button image information --->
</p>
<p>
</p>
</BODY>
</HTML>