[WEB4LIB] MouseOver Mess

TMGB bennettt at am.appstate.edu
Tue Jul 6 14:50:34 EDT 1999


Yours is very similar to the one I use.  The big difference is the
function and number of parameters to the function call.  I'm not sure
what you are trying to do with the for loop but it sounds like each call
is going through the loop only one time and therefore using an index of
0 giving you image 0+1 every time.  Even if you were able to make i a
static variable, it seems that you would have to roll over each image in
order for the for loop to work.  Also, I don't know if you can do this
in JAVA but you defined the function with no arguments and then send it
two arguments on every call.  You may want to try this function I've
sent and just call it with image1, image2, etc.

Thomas

<SCRIPT LANGUAGE="JavaScript">
<!--
if (document.images){
...

pic9on=new Image();
pic9on.src="/Templates/ButtonBar/LHP_BlackButtonBig.gif";
pic9off=new Image();
pic9off.src="/Templates/ButtonBar/LHP_Button.gif";
}

function img_act(imgName) {
if (document.images)
        document[imgName].src=eval(imgName+'on.src')}
function img_inact(imgName) {
        document[imgName].src=eval(imgName+'off.src')}
//-->
</SCRIPT>
<A HREF="http://www.library.appstate.edu/Index.html" target="_top" 
OnMouseOver="img_act('pic9')" 
OnMouseOut="img_inact('pic9')">
<IMG SRC="/Templates/ButtonBar/LHP_button.gif" NAME="pic9" 
ALT="Link to the Appalachian State University Library Home Page" 
BORDER=0  ALIGN=CENTER></A>



Jay Frantz wrote:
> 
> Alright, let me up, I've had enough...What am I doing wrong here? I can
> only get the first .gif to mouseover. Am I missing something?
> 
> See the mess below:
> <script> language="JavaScript">
> <!--
> 
> if (document.images) {
>   image1on = new Image();
>   image1on.src = "information3.gif";
> 
>   image1off = new Image();
>   image1off.src = "information.gif";
> }
> 
> function changeImages() {
>   if (document.images) {
>     for (var i=0; i<changeImages.arguments.length; i+=2) {
>       document[changeImages.arguments[i]].src =
> eval(changeImages.arguments[i+1] + ".src");
>     }
>   }
> }
> // -->
> </script>
> </head>
><A HREF="http://www.library.ci.corpus-christi.tx.us/home/info.htm"
> onmouseover="changeImages('image1', 'image1on')"
>  onmouseout="changeImages('image1','image1off')"><img
> src="information.gif" width=152 height=41 border=0
> name="image1"></A></TD></TR>
> 
> Regards,
> 
> JH Frantz

-- 
----------------------------------------------------------------------
Thomas McMillan Grant Bennett           Appalachian State University
Computer Consultant II                  University Library
bennettt at am.appstate.edu               
http://www.library.appstate.edu/admin/
Voice:  828 262 6587			FAX:    828 262 3001

Windows 95 is a 32-bit extension to a 16-bit patch for an 8-bit
operating system that was originally coded for a 4-bit microprocessor.
 - Chris Dunphy     Boot Magazine


More information about the Web4lib mailing list