Click the button to get the text content and change the js Implementation of the style, buttontext

Source: Internet
Author: User

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 ';
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.