SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2006
    Location
    California
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Change window location with enter on text field

    How can I re-direct a page (or change the window location) to a different URL by pressing the enter key in a form's text field on a ASPX page?

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    set the action attribute on the form.
    Code:
    <form action="foo.html">

  3. #3
    SitePoint Member
    Join Date
    Aug 2008
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    else, you can use onsubmit event.

    <form action="#" method="get" onsubmit="url=document.getElementById('someTextField').value;window.location.href=url;">


Tags for this Thread

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
  •