HTML5

<html>
<head>
 <title> HTML</title>
</head>
<body >
 <h1>会员注册界面</h1>
<form action="file:///D|/process.aspx" method="post" name="f1">
 用户名称:<input type="text" name="user" id="m1" value="张三 "></br>
 联系电话:<input type="text"  id="m2" value="13705025431"></br>
 密码:<input type="password" id="m3" ></br>
 确认密码:<input type="password" id="m5" onBlur="judge();"></br>
 性别:<input type="radio" name="male" id="m4" value="male" checked="true">男
 <input type="radio" name="male" value="female">女
 
 </br>
 爱好

 <input type="checkbox" name="sport" id="t1" value="sport" checked="true">体育<br>
 <input type="checkbox" name="music" id="t2" value="music">音乐<br>
 <input type="checkbox" name="wenxue" id="t3" value="wenxue">文学<br>
 <input type="checkbox" name="qita" id="t4" value="qita">其他<br>
 <input type="button" value="测试" id="tbtn"  name="sub"  onClick="test();"/>
 </br>
 
 特长
    <select name ="sports" id="sports">
<option id="q1"  value="书法">书法</option>
<option id="q2" value="文学写作">文学写作</option>
<option id="q3" value="阅读">阅读</option>
</select>
</form>
<script type="text/javascript">
   function judge()
   {   var str1=document.getElementById("m3").value;
       var str2=document.getElementById("m5").value;
    if(str1!=str2) alert("两次密码输入不正确");
    document.getElementById("m3").value
   
    }
  function test()
  { 
       var str=""
 
 
    str +=document.getElementById("m1").value
    str +=document.getElementById("m2").value
    var bm=document.getElementById("m4").checked
   
    if(bm) str+="男"
       else str+="女"
       b=document.getElementById("t1").checked
    if(b) str+="体育"
       b=document.getElementById("t2").checked
    if(b) str+="音乐"
        b=document.getElementById("t3").checked
     if(b) str+="文学"
     b=document.getElementById("t4").checked
     if(b) str+="其他"
   var obj=document.getElementById('sports')
        var index=obj.selectedIndex
         str+= obj.options[index].value
     document.write(str)
    
  
  }
  
 
  </script>
    <script language="javascript">
var Arraycolor=new Array("#00FF66","#FFFF99","#99CCFF","#FFCCFF","#FFCC99","#00FFFF","#FFFF00","#FFCC00","#FF00FF");
var n=0;
function turncolors(){
 n++;
 if (n==(Arraycolor.length-1)) n=0;
 document.bgColor = Arraycolor[n];
 document.fgColor=Arraycolor[n-1];
 setTimeout("turncolors()",1000);

 
}
turncolors();
</script>
</body>
</html>


 

posted on 2016-03-20 10:36  ssangelia  阅读(124)  评论(0编辑  收藏  举报

导航