Saturday, 15 June 2013

javascript - Submit/Simulate keypress HTML -


I have a button, & lt; Input type = "button" name = "button" & gt; When I click on it, I get another input text & lt; Input type = "text" name = "btxt" & gt; I present a javascript from which takes some irrelevant actions for this question,

Question: Is it possible that I would not let this javascript click on the button instead of pressing Return on the keyboard Triggering.

Note: These input forms are not inside the tags

  & lt ;! DOCTYPE HTML Public "- // W3C // DTD XHTML 1.0 Strict // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-ercd.dtd" & gt; & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" XML: lang = "en" lang = "en" dir = "ltr" & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> & Lt; Title & gt; Onyx Test & lt; / Title & gt; & Lt; Script language = "javascript" & gt; Function keydown (event) {if (event.keyCode == 13) {// If you are using jQuery, then just write it: // $ ('# testbutton'). Triggers ('Clicks'); FireClickEvent (document.getElementById ('testbutton')); }} // Event firing portable function is not a fireclick event (control) {if (document.all) {control.fireEvent ("onclick"); } Else {var clickEvent = window.document.createEvent ("MouseEvent"); ClickEvent.initEvent ("click", wrong, true); Control.dispatchEvent (clickEvent); }} & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body onkeydown = "keyDowns (event);" & Gt; & Lt; Input type = "button" name = "button" value = "test" id = "test button" onclick = "warning ('I clicked, whatever you can do')" /> & lt; / Body & gt; & Lt; / Html & gt;  

No comments:

Post a Comment