Question: Concerning the Implementation of getting text content and changing the style of an altar friend, the altar friend text
Requirement: click "button" to obtain the selected content in the input box, so that the selected content becomes red,
Implementation: The Code is as follows:
1: <!DOCTYPE HTML>
2:
3:
4: <meta http-equiv="content-type" content="text/html;charset=utf-8">
5: <title>Test</title>
6: <style type="text/css">
7: div{
8: display: none;
9: }
10: </style>
11:
12: <body>
13: <input type="text" id="txt" value="" />
14: <input type = "button" value = "get the value in the text box" id = "btn" onclick = "getText ();"/>
15: <div id="showText">
16:
17: </div>
18: <script type="text/javascript">
19: function getText () {
20: var showText = document.getElementById("showText");
21: showText.style.display = "block";
22: showText.style.color = "red";
23: showText.innerHTML=document.getElementById("txt").value;
24: }
25: </script>
26: </body>
27:
Effect:
If you have a better method, please contact us. Sorry for the shortcomings.
Source: http://www.ido321.com/539.html
How can I get the content before the text changes to a textbox?
You can declare a string as the content of the previous Temporary change. In the textchanged event process, assign the current value to this temporary variable. In the next textchanged event, this temporary variable is the content before the change. Can this happen?
Java interface to obtain a JTextFiled Content Method
Increase the amount of your code .. Is it possible to calculate money based on the number of lines of code...
Simplified. It is no different from getText...
Public String getString (JTextFiled t ){
Return t. getText ();
}
You can do it yourself... it's totally unnecessary...