Forum Moderators: mack

Message Too Old, No Replies

trigger form action with a text link

replacing paypal buttons

         

stef25

12:13 pm on Sep 21, 2005 (gmt 0)

10+ Year Member



is it possible to trigger a form action using a text link? at the moment this only works with input type=image or input type=button

id like to replace the paypal buttons with a simple "buy now" ahref and/or some javascript

thanks,
stef

txbakers

12:47 pm on Sep 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



onClick= "document.myForm.submit()"

stef25

4:22 pm on Sep 21, 2005 (gmt 0)

10+ Year Member



how do i determine the name of the form, using id="?

txbakers

5:06 pm on Sep 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can have multiple forms on the page, and code the formname differently for each one.

alex77

10:10 pm on Sep 21, 2005 (gmt 0)



For an elegant solution, you can use
onClick="this.form.submit();"

since the element inside a form does know the form it is in.

If you're trying to create an alternative to a button, you can use a combination of

onClick
and css to emulate that on pretty much any html object. Check
style="cursor:pointer;"
to have the cursor change into the hand symbol when moving over the object.