Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    406
    Thanks
    0
    Thanked 0 Times in 0 Posts

    submitting a form

    I have a form with text boxes. Also instead of a submit button, I have an image. Once the user fills out the form, if he hits the enter key the form should submit. But since I am using an image nothing is happening. How can I write a javascript so when the user hits the enter key the form automatically gets submited? Here is what I wrote which is not working:

    <form name="newcustomer" method="post" action="http://www.hotmail.com">

    <input type="texbox" size="30" name="fname"><br>
    <input type="textbox" size="30" name="lname"><br>
    <A HREF="javascript:document.newcustomer.submit()"><img src="images/save.gif" border="0"></a>

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <input>'s of type image act just like <input>'s of type submit, meaning they both act as a submit button

    <input type="image" src="images/save.gif" />

    http://msdn.microsoft.com/workshop/a...nput_image.asp
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Is that consistent behavior with the other browsers out there, or is IE diverging from the standard?
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No, it's been that way since HTML 3.2 at least.

    Ooh, look! It was in HTML 2!!

    I'd say it's consistent
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    <irony>
    Not Tim Berners-Lee's original version? Bad - there's probably lots of browsers out there who only knows his version.</irony>
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    406
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks it worked

    It doesnt work in Netscape 4.7. It works in NN6.x


  •  

    Posting Permissions

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