Home  >  Article  >  Web Front-end  >  How to get the value of radio button and check box in js_form effects

How to get the value of radio button and check box in js_form effects

WBOY
WBOYOriginal
2016-05-16 18:42:271186browse
Copy code The code is as follows:

// JavaScript Document
function sub1()
{
// Use the Form name to directly reference the form object

//form1.method = "get";

// Use the form name as an attribute of the document object to reference the form object,

// And use user as the attribute of the form object to refer to the text box element object named user

// document.form1.user.value = "lisi"; document.getElementById("s1");
var s2=document.getElementById("s2");
var s3=document.getElementById("s3");
var s4=docu ment.getElementById(" s4 "); var s5 = document.GetelementByid (" s5 ");
S1.Innertext = DOCUMENT.GetelementByid (" Text1 "). Value;
Var obj = sbyname ("Radio" );

for(var i = 0; i < obj.length; i )
{

if(obj[i].checked)
{
s2.innerText =obj[i].value;
}
}
var obj1 = document.getElementsByName("fuxuan");
for(var i = 0; i < obj1.length ; i )
{
if(obj1[i].checked)
{
s3.innerText =obj1[i].value ' ';

}
}
s4.src=document.getElementById("photoFile1").value;
s5.innerText=document.getElementById("ta1").value;
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn