如何学好java

如何学好java,其实很简单,只要用心体会,慢慢积累!
posts - 106, comments - 7, trackbacks - 0, articles - 3
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

级联

Posted on 2011-11-27 21:29 哈希 阅读(169) 评论(0)  编辑  收藏 所属分类: Js and Jquery 常用总结

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
 select{
  font-size:30px;
 }
</style>
</head>

<body onload="bornCity('p000')">
 <script language="javascript">
  var pcs=new Array();
  pcs[0]=new Array("p000","==请选择省==","0");
  pcs[1]=new Array("p001","==陕西==","0");
  pcs[2]=new Array("p002","==广东==","0");
  pcs[3]=new Array("p003","==山西==","0");
  pcs[4]=new Array("c001","==西安==","p001");
  pcs[5]=new Array("c002","==渭南==","p001");
  pcs[6]=new Array("c003","==深圳==","p002");
  pcs[7]=new Array("c005","==佛山==","p002");
  pcs[8]=new Array("c006","==东莞==","p002");
  pcs[9]=new Array("c007","==大同==","p003");
  pcs[10]=new Array("c008","==请选择市==","p000");
  
  
  
  function bornCity(value){
   var city=document.getElementById("city");
   //清空
   city.options.length=0;
   
   for(var i=0;i<pcs.length;i++){
    if(pcs[i][2]==value){
     city.options.add(new Option(pcs[i][1],pcs[i][0]));
    }
   }
   
   
   
  }
  
  
  
  
 </script>
 <form name="pcfrm">
  省:
  <select name="province" onchange="bornCity(this.value);">
   <script language="javascript">
    for(var i=0;i<pcs.length;i++){
    
     if(pcs[i][2]=="0")
     {
      document.write("<option value='"+pcs[i][0]+"'>"+pcs[i][1]+"</option>");
     } 
    }
   </script>
  </select>
  市:
  
  <select name="city" id="city">
   
  </select>
 </form>
</body>
</html>


只有注册用户登录后才能发表评论。


网站导航: