In this articles i will explain about one more standard web control. This control is used to enter the data or can take data from user i:e Text Box.In asp.net Text box has properties to restrict the Lines of data which is Tex Mode property(Single Line and MultiLine).The following example shows how to populate text box with other text box value using Java Script.
Java Script is client side programming which has an event "onblur" to focus functionality.In java script we can't get control value directly.If you want to get the control value,First we need to get the control id using "getElementById" then we can get the value as result.In the above example i have used two text box controls .When the focus has come to second text box ,it will be filled with first Text Box.
Java Script is client side programming which has an event "onblur" to focus functionality.In java script we can't get control value directly.If you want to get the control value,First we need to get the control id using "getElementById" then we can get the value as result.In the above example i have used two text box controls .When the focus has come to second text box ,it will be filled with first Text Box.
<html> <head> <script> function AppendDataToOtherTextBox() { var BName=document.getElementById("BooKName"); var BBN=document.getElementById("BooKName1"); BBN.value=BName.value; } </script> </head> <body> Enter Book name: <input type="text" id="BooKName" onblur="AppendDataToOtherTextBox()"> Blur Field: <input type="text" id="BooKName1"> </body> </html>
No comments:
Post a Comment