Click the button to get the text content and change the js Implementation of the style, buttontext
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:
<! Doctype html>
Effect:
In html, how does one click a radio button to update the content in the text below? You can use js or other scripting languages.
<Script language = "javascript"> window. onload = function () {var objs = document. getElementsByName ("product"); for (var I = 0; I <objs. length; I ++) {objs (I ). onclick = function () {document. getElementById ("vern "). value = this. value ;}}} </script> <input type = radio NAME = product id = "2 s" VALUE = "2 s"/> 2 s <br> <input type = radio NAME = product id = "2a" VALUE = "2a"/> 2a <br> <input type = radio NAME = product id = "3 t" VALUE = "3 t" CHECKED/ > 3 t <br> <input type = radio NAME = product id = "3 w" VALUE = "3 w"/> 3 w <br> <input type = "text" name = "vern" id = "vern" value = {ver} onfocus = "if (this. value = '{ver}') this. value = ''" onblur = "if (! Value) {value = '{ver}'} "style =" color: gray; "/>
In the absence of form forms in jsp, How can I obtain text content by clicking the button to trigger the js method?
Node modification: <input type = "text" name = "tee" id = "tee"/>
Function implementation:
Function ee (){
Var sVal = document. getElementById ('TEE '). value;
Alert (sVal );
Window. location = '001.html ';
}