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 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Cant use Enter??????

    Hi

    I am using a very simple search-type page to enable users to input a model number and its page appears in a inline frame. Its not a true search as it is simply relying on a person entering the correct html page name to find it. But this works perfectly in my application.

    The problem I have is that I cannot get the type box to accept enter key as a submitt, only a click of the mouse will submitt the request. If enter is pressed the box loses the users input but no action is taken.

    I think this may be a javascript issue. I have posted the code below.

    Can anyone help?

    [CODE]
    <html>
    <head>
    <script language=javascript >

    function changeF(url) {
    parent.frames['I1'].location.href = url + ".htm"
    }
    </script>
    </head>

    <body>
    <BODY>

    <form name="form1" method="get">
    <p align="right">
    <input type="input" name="test" value="" alt="Please use lower case and no spaces in your search. use simple terms such as motor, pump, d661 etc etc">
    <input type="submit" name="hi" value="Search By Model Name" onclick="changeF(document.form1.test.value)">
    <img src="images/info-symbol.gif" width="23" height="22" alt="Please use lower case only, and keep search terms simple. e.g. pump or g761">&nbsp; or use the drop down menu</p>
    </form>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    </body>
    </html>
    [CODE]

  • #2
    Regular Coder
    Join Date
    May 2008
    Location
    Oxford, UK
    Posts
    422
    Thanks
    14
    Thanked 27 Times in 27 Posts
    When you hit enter does the page reload?

    I had a similar problem and this fixed it...

    Code:
    <input type="submit" name="hi" value="Search By Model Name" onclick="changeF(document.form1.test.value);return false;">

  • #3
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts
    Closed. Thread cross posted here: http://www.codingforums.com/showthread.php?t=165635
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.


  •  

    Posting Permissions

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