Idocs Guide to HTML

Rollover Submit Image: Other Settings

By default, all the rollover submit script requires is the sources of the "over" and "out" images and a nickname for the image. The script allows you to set a few other optional settings as well:

<FORM ACTION="../cgi-bin/" NAME="myform">
email: <INPUT NAME="email">

<SCRIPT TYPE="text/javascript">
var sr = new submitroll("submit.out.gif","submit.over.gif","mysubmit");



The code here is almost the same as in our previous example. This time we've just added a few lines.

By default the alternate text for the image is Submit Query. In our example above, sr.alt="OK"; sets the alternate text as "OK" to match the text in the image.

sr.width=60; and sr.height=60; set the width and height of the image.

Finally, the script gives an opportunity to add some attributes to the <IMG ...> tag. In this the form looks better if the text field is aligned with the top of the image instead of the bottom so we add sr.otheratts="ALIGN=TOP";.

Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.