javascript - how to pass text box value to java script after leaving from text box? -


  & lt; html & gt; & lt; body & gt; & Lt; input type = "text" id = "t1" नाम = "t1" / & gt; & lt; इनपुट प्रकार = "बटन" मान = "संपादित करें" onClick = "संपादित करें (document.getElementById ('t1')। मान)" /> & Lt; div id = "div1" शैली = "प्रदर्शन: कोई नहीं" & gt; & lt; input type = "text" id = "t2" नाम = "t2" मान = "2" / & gt; & Lt; / div & gt; & LT; स्क्रिप्ट & gt; फ़ंक्शन संपादित करें () {x = document.getElementById ('t1')। मान; if (x == "1234") {document.getElementById ('div1')। style.display = 'block'; चेतावनी (x); } और {document.getElementById ("div1")। Style.display = 'none'; चेतावनी (x); }} & lt; / script & gt; & Lt; / body & gt; & Lt; / html & gt;   

यहां मैं div को अक्षम करने के लिए बटन पर क्लिक करने के लिए पाठ बॉक्स t1 के मान को पारित कर दिया है, लेकिन मैं यहां बटन नहीं चाहता, बजाय जब पाठ बॉक्स से निकल रहा हूँ (दर्ज करने के बाद) मान) मुझे टेक्स्ट बॉक्स से स्क्रिप्ट को कॉल करना है I लेकिन इसे टेक्स्ट बॉक्स में सभी दर्ज किए गए मानों को पास करना होगा।

जैसे,

  & lt; इनपुट प्रकार = "टेक्स्ट" id = "t1" name = "t1" onclick = "संपादित करें (document.getElementById ( 't1') मूल्य।);" / & Gt;   

कृपया मदद करें? मैं जावास्क्रिप्ट में यह जावास्क्रिप्ट नहीं चाहता? कृपया मुझे मार्गदर्शन करें।

आप पाठ बॉक्स पर एक onblur ईवेंट को चालू कर सकते हैं ।

जब फोकस पाठ बॉक्स से बाहर निकलता है, तो फ़ंक्शन को कॉल करें जिसे आपको चाहिए।

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -