| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 535 人关注过本帖
标题:关于JS级联的问题。为什么能在谷歌浏览器上而不能在IE浏览器上实现?
只看楼主 加入收藏
holyhsw
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2011-6-12
结帖率:40%
收藏
 问题点数:0 回复次数:0 
关于JS级联的问题。为什么能在谷歌浏览器上而不能在IE浏览器上实现?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<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">
    var provinces = null;
    var cities_hn = null;
    var cities_hb = null;
    var roads_cs = null;
    var roads_zz = null;


    var selectedProvince = null;
    var selectedCity = null;
    var selectedRoad = null;

    function initVariables(){
        try{

        //省份
            provinces = [ {
                name : "湖北",
                //cities : cities_hb
            }, {
                name : "湖南",
                //cities : cities_hn
            } ];

            //湖北的城市
            cities_hb=[{
            name:"武汉",
            roads:[]
            },{
            name:"宜昌",
            roads:[]
            }];
            //湖南的城市
            cities_hn=[{
            name : "长沙",
            //roads:roads_cs
            },{
            name : "株洲",
            //roads:roads_zz
            }];
        //长沙的街道
            road_cs = [{
            name:"黄兴路"
            },{
            name:"下河街"
            },{
            name:"宝蓝街"
            }];
            //株洲的街道
            road_zz = [{
            name:"株洲1"
            },{
            name:"株洲2"
            },{
            name:"株洲3"
            }];
            
            
            
        }catch(e){
            alert(e+":初始化发生错误,请检查后台程序");
        }
    }
    function init(){
        initVariables();
        initProvincesSel();
    }

    function initProvincesSel(){
    if(provinces && cities_hb && cities_hn && roads_cs && roads_zz){
            initVariables();
        }
        var s1= document.getElementById("s1");
        initSelect(s1,"----请选择省份----",0);
        addOptions(s1,provinces);
        }

    function initSelect(sel, text, value){
        sel.options.length = 0;
        var option =new Option (text);
        sel.appendChild(option);
    }

    function addOptions(target,arr){
        if(!(arr instanceof Array)){
            return;
        }
        for(var i = 0; i < arr.length ; i++){
            var pointer = arr[i];
            var option = new Option(pointer.name);
            target.appendChild(option);
        }
    }

</script>

 </head>

 <body onload = "init()">
    省份:
    <select id = "s1">
        <option>----请选择省份----</option>
        </select>
    城市:
        <select id = "s2">
        <option>----请选择城市----</option>
        </select>
    街道:
        <select id = "s3">
        <option>----请选择街道----</option>
        </select>
 </body>
</html>
搜索更多相关主题的帖子: javascript head 谷歌浏览器 IE浏览器 content 
2012-03-15 17:03
快速回复:关于JS级联的问题。为什么能在谷歌浏览器上而不能在IE浏览器上实现?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025111 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved