这是一个省市联动,求哥哥姐姐帮助
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TraceBill.aspx.cs" Inherits="Sell_TraceBill" Theme="SkinFile"%><!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 runat="server">
    <title>销售跟单</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>  
    <link href="../Style/sub1.css" rel="stylesheet" type="text/css" />
    <link href="../Style/menud.css" rel="stylesheet" type="text/css" />
</head>
<body onload="init()"> 
    <form id="form1" runat="server"  method="post" name="creator" enctype="multipart/form-data">
<script language="javascript">   
<!--  
var where = new Array(35);   
function comefrom(loca,locacity) { this.loca = loca; this.locacity = locacity; }   
where[0]= new comefrom("请选择省份名","请选择城市名");  
where[1] = new comefrom("北京","|东城|西城|崇文|宣武|朝阳|丰台|石景山|海淀|门头沟|房山|通州|顺义|昌平|大兴|平谷|怀柔|密云|延庆");   
where[2] = new comefrom("上海","|黄浦|卢湾|徐汇|长宁|静安|普陀|闸北|虹口|杨浦|闵行|宝山|嘉定|浦东|金山|松江|青浦|南汇|奉贤|崇明");   
where[3] = new comefrom("天津","|和平|东丽|河东|西青|河西|津南|南开|北辰|河北|武清|红挢|塘沽|汉沽|大港|宁河|静海|宝坻|蓟县");   
  
function select()
{  
    with(document.creator.province)
    { 
        var loca2 = options[selectedIndex].value; 
    }  
    for(i = 0;i < where.length;i ++) 
    {  
        if (where[i].loca == loca2)
        {  
            loca3 = (where[i].locacity).split("|");  
            for(j = 0;j < loca3.length;j++)
            {
              with(document.creator.city) 
              { 
                length = loca3.length; options[j].text = loca3[j]; options[j].value = loca3[j]; var loca4=options[selectedIndex].value;
              }
            }  
        break;  
        }
    }  
  document.creator.newlocation.value=loca2+loca4;  
}  
function init() 
{  
    with(document.creator.province) 
    {  
        length = where.length;  
        for(k=0;k<where.length;k++) { options[k].text = where[k].loca; options[k].value = where[k].loca; 
    }  
        options[selectedIndex].text = where[0].loca; options[selectedIndex].value = where[0].loca;  
}  
with(document.creator.city) 
{  
    loca3 = (where[0].locacity).split("|");  
    length = loca3.length;  
    for(l=0;l<length;l++) 
    {
       options[l].text = loca3[l]; options[l].value = loca3[l];
    }  
    options[selectedIndex].text = loca3[0]; options[selectedIndex].value = loca3[0];  
  }
}  
-->  
</script> 
<div> 
<table>
<tr>
<td>省份</td>
<td><select name="province" onchange= "select()" style=" width:138px;" onload="init()"></select>
</td><td>城市</td>
<td><select name="city" onchange= "select()" style=" width:138px;" onload="init()"></select><span style="display:none;"><input type="text" name="newlocation" maxlength="12" size="12" style="font-weight: bold" /></span></td>
<tr>
 </table>
   </div>
    </form>
</body>
</html>省市太多,故只取了一小部分

解决方案 »

  1.   

    在你觉得消失了的部分插一句 alert("XXXXX");//XXXXX为提示的内容自己写点东西,知道是哪个位置的alert就行有警告框弹出就是调用没有问题,检查代码有没有写错没有警告框弹出就是调用出问题了,检查调用部分
      

  2.   

    如果你是完全copy过来的话,这代码还有一个错误,最后一个</tr>写成</tr>了
      

  3.   

    不好意思上面打错字了<table>
    <tr>
    <td>省份</td>
    <td><select name="province" onchange= "select()" style=" width:138px;" onload="init()"></select>
    </td><td>城市</td>
    <td><select name="city" onchange= "select()" style=" width:138px;" onload="init()"></select><span style="display:none;"><input type="text" name="newlocation" maxlength="12" size="12" style="font-weight: bold" /></span></td>
    <tr> <--这个地方应该是</tr>
     </table>