Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with <form> <input> and a rollover-gif to call a .js-functio 2

Status
Not open for further replies.

Dragonfish

Programmer
Apr 25, 2001
62
UG
I´m trying to use a rollover GIF to start a js-function (don´t worry about some of the text - it´s a german site). here´s the code with some comments.

<html>

<head>
<title>hauptfenster</title>
<link rel=stylesheet type=&quot;text/css&quot; href=&quot;textstyle.css&quot;>
<meta name=&quot;author&quot; content=&quot;gullever&quot;>
<meta name=&quot;generator&quot; content=&quot;Ulli Meybohms HTML EDITOR&quot;>
<script language=&quot;JavaScript&quot; src=&quot;steuern.js&quot; type=&quot;text/javascript&quot;></script>

</head>
<body text=&quot;#FF0000&quot; bgcolor=#C0C0C0 link=&quot;#FF0000&quot; alink=&quot;#FF0000&quot; vlink=&quot;#FF0000&quot;>

<onLoad=&quot;MM_preloadImages('button1-2.gif')&quot;>
<onLoad=&quot;MM_preloadImages('button2-2.gif')&quot;>

<FORM>
<input type=&quot;button&quot;
value=&quot;Test_Funktion&quot;
onclick=&quot;Herren_eins()&quot;>
</FORM> *** this first try worked fine ***

<FORM>
<input type=&quot;image&quot;
src=&quot;button1-1.gif&quot;
class=style_button1
onclick=&quot;Herren_eins()&quot;>
</FORM> *** this second try worked as well (except for the stylesheet but I´ll solve that later

<FORM>
<input type=&quot;image&quot;
src=&quot;button1-1.gif&quot;
width=&quot;20&quot;
height=&quot;20&quot;
onMouseOut=&quot;MM_swapImgRestore()&quot;
onMouseOver=&quot;MM_swapImage('Image1','','button1-2.gif',1)&quot;
onclick=&quot;Herren_eins()&quot;>
</FORM> *** this is where the troubel starts, netscape and IE give completly different results (the functions I borrowed from Dreamweaver, I know they work). The GIFs are just two different colored boxes for testing ***

<FORM>
<input type=&quot;image&quot;
onMouseOut=&quot;MM_swapImgRestore()&quot;
onMouseOver=&quot;MM_swapImage('Image1','','button2-2.gif',1)&quot;
onclick=&quot;Herren_eins()&quot;>
<img name=&quot;Image1&quot; border=&quot;0&quot; src=&quot;button2-2.gif&quot; width=&quot;20&quot; height=&quot;20&quot;>
</FORM> *** does´nt work either and I can´t find any documentation giving me the right syntax

</body>

</html>

Thanks for the help !!!
David in Germany
 
The reason that NS doesnt execute the script is because you didnt define Herren_eins(), is this the name of the function?? ANd I saw that you're importing an external .JS file, is Herren_eins() defined in there??
 
What is the &quot;Image1&quot; for? If what I assume is right this borrowed function from DreamWeaver is that &quot;Image1&quot; Is the name/id of the img element to change the .gif for. If you name the individual input tags individually with a name or id property i.e.

<input type=&quot;image&quot;
src=&quot;button1-1.gif&quot;
width=&quot;20&quot;
height=&quot;20&quot;
id=&quot;inputnamehere&quot;
onMouseOut=&quot;MM_swapImgRestore()&quot;
onMouseOver=&quot;MM_swapImage('Image1','','button1-2.gif',1)&quot;
onclick=&quot;Herren_eins()&quot;>

Then maybe this will work...
Or am I completely off the track?

You're only as good as your last answer!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top