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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rollover as submit button 2

Status
Not open for further replies.

nachilev

Technical User
Apr 10, 2003
13
US
Is there a (fairly simple)straightforward way to use a rollover as a "Submit" button on a form?
(it will send the information to a Php page.

Any help will be VERY helpful.

Thank you!
 
There are several ways to acomplish it.

The simplest way, is to construct the link with the values that the form is going to send.

Something like:

process.php?value1=somevalue&value2=someothervalue....
But you'll need some javascript to capture the values without the submit
Then the values will be available in the processing page.

The other way, is to have the rollover call a javascript function that will submit the form. something like onclick=this.form.submit()

The third ooption that invloves no javascript is to style the submit button using CSS to make it look like a rollover.

The first two rely heavily on javascript, which if turned off would render them useless, the third option relies on CSS which would require some coding to get the appearance right.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
The third ooption that invloves no javascript is to style the submit button using CSS to make it look like a rollover.

Unfortunately this option requires you to use the :hover pseudo class which is only supported on anchors (<a>) in IE, (for some stupid reason). Which means that if you want to use a true submit button (<input type="submit">) with rollovers, you will have to use javascript to make it cross-browser compatible. Fortunately this solution degrades nicely because in the event that the user has javascript turned off it simply does nothing - so it is a very unintrusive solution.
Code:
<input type="submit" value="submit me" onmouseover="this.style.backgroundColor = '#ffffff'" onmouseout="this.style.backgroundColor = '#cccccc'">

-kaht

How much you wanna make a bet I can throw a football over them mountains?
sheepico.jpg
images
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top