Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Focusing a HTML button in Javascript..

Focusing a HTML button in Javascript..

Scheduled Pinned Locked Moved ASP.NET
javascripthtmltutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Balagurunathan S
    wrote on last edited by
    #1

    Dear Friends.. I am having an .aspx page in which i have various HTML controls such as text boxes and buttons("OK" and "CLEAR" buttons).By default, when i press the "ENTER" key in my keyboard ,the "OK" button must get fired...But its not getting fired..I need to use the tab button to make that "OK" button get fired..How to make the "OK" button get fired without using the TAB key..? " I use javacript for validation..Is there anything do with javascript in this regard..? Regards,

    Balaguru

    B G 2 Replies Last reply
    0
    • B Balagurunathan S

      Dear Friends.. I am having an .aspx page in which i have various HTML controls such as text boxes and buttons("OK" and "CLEAR" buttons).By default, when i press the "ENTER" key in my keyboard ,the "OK" button must get fired...But its not getting fired..I need to use the tab button to make that "OK" button get fired..How to make the "OK" button get fired without using the TAB key..? " I use javacript for validation..Is there anything do with javascript in this regard..? Regards,

      Balaguru

      B Offline
      B Offline
      Balagurunathan S
      wrote on last edited by
      #2

      Sorry Friends... A small correction in the above post..I need to fire a image.i.e i am having an image button instead of HTML Button.. Regards,

      Balaguru

      M 1 Reply Last reply
      0
      • B Balagurunathan S

        Sorry Friends... A small correction in the above post..I need to fire a image.i.e i am having an image button instead of HTML Button.. Regards,

        Balaguru

        M Offline
        M Offline
        mani_iips
        wrote on last edited by
        #3

        Hello.. i am not very sure how asp.net renders the image button into the html. But anyhow u can try this.. //on preRender myImageButton.attributes.add("type", "submit"); On pressing enter key, the Form.Submit event is fired. By assosiaciting the above attribute with ur image buttong it will work if the Image Button is renndered as , but otherwise too u can use the same understanding to get the job done. Keep me updated with the same.. Regards.

        B 1 Reply Last reply
        0
        • B Balagurunathan S

          Dear Friends.. I am having an .aspx page in which i have various HTML controls such as text boxes and buttons("OK" and "CLEAR" buttons).By default, when i press the "ENTER" key in my keyboard ,the "OK" button must get fired...But its not getting fired..I need to use the tab button to make that "OK" button get fired..How to make the "OK" button get fired without using the TAB key..? " I use javacript for validation..Is there anything do with javascript in this regard..? Regards,

          Balaguru

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Normally when you press enter, the first button in the form is activated. There are some form elements that catch the enter key, though, like textarea and select. If you want the enter key to work when these controls have focus, you have to use Javascript to catch the key and post the form instead.

          --- single minded; short sighted; long gone;

          1 Reply Last reply
          0
          • M mani_iips

            Hello.. i am not very sure how asp.net renders the image button into the html. But anyhow u can try this.. //on preRender myImageButton.attributes.add("type", "submit"); On pressing enter key, the Form.Submit event is fired. By assosiaciting the above attribute with ur image buttong it will work if the Image Button is renndered as , but otherwise too u can use the same understanding to get the job done. Keep me updated with the same.. Regards.

            B Offline
            B Offline
            Balagurunathan S
            wrote on last edited by
            #5

            Hi Mani.. Ok..Fine..But i need to write in HTML content...How to do it in javascript..? Regards,

            Balaguru

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups