js给文本框赋值-网站相关-魔数师说
首页 更多分类 网站相关 正文

js给文本框赋值

js给文本框赋值

扫码手机浏览

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> New...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
  <title> New Document </title> 
  <meta name="Generator" content="EditPlus"> 
  <meta name="Author" content=""> 
  <meta name="Keywords" content=""> 
  <meta name="Description" content=""> 

  <script type="text/javascript">	

  function getUri(){ 
              
  var uri=''; 
  //alert(document.getElementById("Y").checked); 
  if (document.getElementById("Y").checked){ 
                 uri=document.getElementById("Y").value;  
  } 
  if (document.getElementById("M").checked){ 
if (uri==''){ 
   uri=uri+document.getElementById("M").value; 
}else{ 
   uri=uri+"/"+document.getElementById("M").value; 
} 
   
      } 
  if (document.getElementById("D").checked){ 
     if (uri==''){ 
   uri=uri+document.getElementById("D").value; 
}else{ 
   uri=uri+"/"+document.getElementById("D").value; 
} 
      } 
  document.getElementById("test").value=uri; 
  } 
</script> 
</head> 

<body> 
        <input type="checkbox" id="Y" name="Y" value="YYYY" onclick="getUri()"/>年 
<input type="checkbox" id="M" name="M" value="MM" onclick="getUri()"/> 月 
<input type="checkbox" id="D" name="D" value="DD" onclick="getUri()"/> 日 

        <input type="text" id="test" name="test"  > 



</body> 
</html>


阅读全文

本文转载自互联网或其他渠道,侵删!