Javascript  -  Multiple Rollovers

If you want to use multiple rollover buttons on one NOF page, there is one thing you need to keep an eye on:

Variables *must* change between buttons
In the example on the Rollover page, there are three variables defined:

  1. button - the variable applied to the button “object” on the page
  2. button1 - the variable applied to the “normal” image
  3. button2 - the variable applied to the “mouseover” image


if you create a second Rollover button, you would follow the same instructions, but change these three variables (and their .src versions as well) so that they were not the same.  For instance, for the second rollover button, you could use this code in the “Object HTML”

<script language = "JavaScript">
<!--
if (document.images) {
button3 = new Image()
button3.src = "../assets/images/picture3.gif"
button4 = net Image()
button4.src = "../assets/images/picture4.gif"
// -->
</script>



... this code in the “Inside Object” tab:

name = otherbutton



... and this code inserted in to the “Inside Tag” field of the “Link HTML”:

onMouseOver = "if(document.images) { otherbutton.src = button4.src}" onMouseout = "if(document.images) { otherbutton.src = button3.src}"

Go Back to Previous Page

Have a question that you can´t find the answer to? Want to report a possible bug?

Send a help request to NetObjects Technical Support