The example of this article tells JS to get the Drop-down box display value and judge the radio button method. Share to everyone for your reference. Specifically as follows:
1. I have done many projects, need to get the value of the Select component display. Here are some of the methods I use frequently:
HTML source code is as follows:
The JS function is as follows:
function Settxt ()
{
var _selobj=document.getelementbyidx_xx (' Province ');//Remove the element var of the Pull box
_selval=_ selobj[_selobj.selectedindex].text;//Remove the selected value
document.getelementbyidx_xx (' Provincename ') of the Drop-down box. Value=_selVal;
2. I have also done a lot to determine whether the radio radio button is selected, the following is my common method:
HTML page source code is as follows:
Function judge ()
{var status =false;
var _radobj=document.getelementsbyname (' time ');
for (var i =0;i<_radobj.length;i++) {
if (_radobj[i].checked) {
status=true
}}
}
if (! Status) {
alert (' Unselected time! ');
}
return status;
}
I hope this article will help you with your JavaScript programming.