get th" />
Current location - Music Encyclopedia - Chinese History - How does js get the value of the input box
How does js get the value of the input box
Method can directly obtain the contents of the input box. Value animal symbol in js.

The code example is as follows:

& lt! DOCTYPE? html & gt

& lthtml & gt

& lthead & gt

& ltmeta? charset="UTF-8 " >

< title > get the value of the input box.

& lt script? type = " text/JavaScript " & gt;

window.onload=function(){

var? Bt = document . getelementbyid(" bt2 ");

var? BTT = document . getelementbyid(" Bt 1 ");

bt.onclick=function(){

alert(Bt 1 . value);

}

}

& lt/script & gt;

& lt/head & gt;

& ltbody & gt

Please enter the content.

& lt input? type="button "? id="bt2 "? Value= "get input data"? /& gt;

& lt/body & gt;

& lt/html & gt; The effect is as follows: