SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Make A Link A Submit Button

    Is there anyway to make a link act as a submit button?
    Any Javascript code one can use for that?

    Thanks!

  2. #2
    pg for mild peril cow's Avatar
    Join Date
    Mar 2000
    Location
    nevada, usa
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this will work:

    Code:
    <a onClick="yourFormName.reset();">click to reset</a>
    but since there isn't an assigned href location, the cursor doesn't change...
    "There's no justice like angry mob justice!" --Seymour Skinner

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!

    Can I do something like;
    Code:
    <a onClick="yourFormName.submit();">click to submit</a>
    And will that then submit the form?

    Tx!

  4. #4
    pg for mild peril cow's Avatar
    Join Date
    Mar 2000
    Location
    nevada, usa
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yep, that'll work

    edit: you should also include this in your link:

    href="javascript:void(0);"

    (java script is one word though...)
    Last edited by cow; Sep 25, 2001 at 16:14.
    "There's no justice like angry mob justice!" --Seymour Skinner

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all the help guys!

    Where in the link do you place that?
    Can you plz write the entire link so I can see?

    Tx!!!

  6. #6
    pg for mild peril cow's Avatar
    Join Date
    Mar 2000
    Location
    nevada, usa
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no prob, here you go:

    Code:
    <a href="javascript:void(0);" onClick="yourFormName.submit();">click to submit</a>
    "There's no justice like angry mob justice!" --Seymour Skinner

  7. #7
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or:

    Code:
    <a href="javascript:yourFormName.submit();">Submit</a>

  8. #8
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Much obliged everyone!
    Tx for your time and help!

  9. #9
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So far, that works great!
    One lasssst question...

    I want to make it that when the form is submitted, it opens in a new window. But, the width should be 418 and the height 450, with no address bar.
    Any ideas?


    Tx!!!

  10. #10
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone.. plz?

    Tx Again!

  11. #11
    pg for mild peril cow's Avatar
    Join Date
    Mar 2000
    Location
    nevada, usa
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    add this to your submit button link:

    onClick="javascript:void(window.open('location_of_new_window.htm','','width=418,height=480,addressbar=0'))"

    of course, you'll want to replace the "location_of_new_window.htm" with the actual location
    "There's no justice like angry mob justice!" --Seymour Skinner


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •