belotte
05-25-2003, 09:37 AM
Let me start out by saying thank you! I have a JavaScript moron so any help is very much appreciated.
I'm trying to writing a script that utilizes multiple instances of the " mouse over " and " mouse out " event handlers. For some reason I just can't seem to get it to work. What I want is when someone rolls over one of the buttons in the upper navigation , 2 things happen; a simple roll over effect and an image to load in a designated space underneath the navigation ( this image would contain information on what the link is).
It took me a long time just to figure how to do the 2 scripts individuall, but together, forget it!
can anybody help me with this please?
Thank you again,
Richard
Here's the code I'm using:
<html>
<head>
<title>Untitled Document</title>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from old browsers
function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}
function changeImages() {
if (document.images) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}
if (document.images) {
homeText = new Image
bgText = newImage
homeText.src = "pix/texth.gif"
bgText.src = "pix/textbg.gif"
}
else {
homeText = ""
bgText.src = ""
document.textField = ""
}
// End hiding scriptfrom old browsers -->
</SCRIPT>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from old browsers
if (document.images) {
homeText = new Image
bgText = new Image
homeText.src = "pix/texth.gif"
bgText.src = "pix/textbg.gif"
}
else {
homeText = ""
bgText.src = ""
document.textField = ""
}
// End hiding scriptfrom old browsers -->
</SCRIPT>
</head>
<body TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0" onLoad="preloadImages();">
<A HREF="indexbb.html"
onMouseover="changeImages('home', 'pix/hr.jpg')",
onMouseover="document.textField.src=homeText.src"
onMouseout="changeImages('home', 'pix/h.jpg')",
onMouseout="document.textField.src=bgText.src";>
<img src="pix/h.jpg" WIDTH=41 HEIGHT=64 BORDER=0 ALT="Home"></A><p>
<img src="pix/textbg.gif" NAME="textField" >
</body>
</html>
And the roll over script:
<html>
<head>
<title>Untitled Document</title>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from old browsers
function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}
function changeImages() {
if (document.images) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}
if (document.images) {
homeText = new Image
bgText = newImage
homeText.src = "pix/texth.gif"
bgText.src = "pix/textbg.gif"
}
else {
homeText = ""
bgText.src = ""
document.textField = ""
}
// End hiding scriptfrom old browsers -->
</SCRIPT>
</head>
<body TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0" onLoad="preloadImages();">
<A HREF="indexbb.html"
onMouseOver="changeImages('home', 'pix/hr.jpg')";
onMouseOut="changeImages('home', 'pix/h.jpg')";>
<IMG NAME="home" SRC="pix/h.jpg" WIDTH=41 HEIGHT=64 BORDER=0 ALT="Home"></A>
</body>
</html>
I'm trying to writing a script that utilizes multiple instances of the " mouse over " and " mouse out " event handlers. For some reason I just can't seem to get it to work. What I want is when someone rolls over one of the buttons in the upper navigation , 2 things happen; a simple roll over effect and an image to load in a designated space underneath the navigation ( this image would contain information on what the link is).
It took me a long time just to figure how to do the 2 scripts individuall, but together, forget it!
can anybody help me with this please?
Thank you again,
Richard
Here's the code I'm using:
<html>
<head>
<title>Untitled Document</title>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from old browsers
function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}
function changeImages() {
if (document.images) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}
if (document.images) {
homeText = new Image
bgText = newImage
homeText.src = "pix/texth.gif"
bgText.src = "pix/textbg.gif"
}
else {
homeText = ""
bgText.src = ""
document.textField = ""
}
// End hiding scriptfrom old browsers -->
</SCRIPT>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from old browsers
if (document.images) {
homeText = new Image
bgText = new Image
homeText.src = "pix/texth.gif"
bgText.src = "pix/textbg.gif"
}
else {
homeText = ""
bgText.src = ""
document.textField = ""
}
// End hiding scriptfrom old browsers -->
</SCRIPT>
</head>
<body TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0" onLoad="preloadImages();">
<A HREF="indexbb.html"
onMouseover="changeImages('home', 'pix/hr.jpg')",
onMouseover="document.textField.src=homeText.src"
onMouseout="changeImages('home', 'pix/h.jpg')",
onMouseout="document.textField.src=bgText.src";>
<img src="pix/h.jpg" WIDTH=41 HEIGHT=64 BORDER=0 ALT="Home"></A><p>
<img src="pix/textbg.gif" NAME="textField" >
</body>
</html>
And the roll over script:
<html>
<head>
<title>Untitled Document</title>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from old browsers
function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}
function changeImages() {
if (document.images) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}
if (document.images) {
homeText = new Image
bgText = newImage
homeText.src = "pix/texth.gif"
bgText.src = "pix/textbg.gif"
}
else {
homeText = ""
bgText.src = ""
document.textField = ""
}
// End hiding scriptfrom old browsers -->
</SCRIPT>
</head>
<body TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0" onLoad="preloadImages();">
<A HREF="indexbb.html"
onMouseOver="changeImages('home', 'pix/hr.jpg')";
onMouseOut="changeImages('home', 'pix/h.jpg')";>
<IMG NAME="home" SRC="pix/h.jpg" WIDTH=41 HEIGHT=64 BORDER=0 ALT="Home"></A>
</body>
</html>