javascript与java代码混成一片................
java代码是在服务器处理
javascript是在浏览器处理
代码逻辑错错错

解决方案 »

  1.   

    静态页是这样的 
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html lang="zh-CN">
      <head>

        
        <title>register.jsp</title>
    <link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-cold-1.css" title="win2k-cold-1" />
      <script type="text/javascript" src="js/calendar.js"></script>
      <script type="text/javascript" src="js/calendar-zh.js"></script>
      <script type="text/javascript" src="js/calendar-setup.js"></script>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

      </head>
      <body>
      <script language="JavaScript" >
    function updateCity(selectProvince)
    {
    bean.Sql sql=new Sql();
    sql.setSql("select * from city where province='"+selectProvince+"'");
    java.sql.ResultSet set=sql.content();
    int i=0;
    while(set.next()){
    document.registerForm.city.options[i]=new Option(set.getString(1),set.getString(2));
    i++;
    }
    }

    </script>
      <form name="registerForm" method="POST" action="/zone/register.do"><br>
      <table width="50%" height="50%" border="1" align="center">
    <tbody><tr>
    <td width=‘40%’ align=center>&nbsp;用户名:</td>
    <td>&nbsp;<input type="text" name="name" value=""></td></tr>
    <tr>
    <td width=‘40%’ align=center>&nbsp;密码:</td>
    <td>&nbsp;<input type="password" name="password" value=""></td></tr>
    <tr>
    <td width=‘40%’ align=center>&nbsp;重复密码:</td>
    <td>&nbsp;<input type="password" name="repassword" value=""></td></tr>
    <tr>
    <td width=‘40%’ align=center>&nbsp;出生时间:</td>
    <td><!-- 两个input要在同一行 -->
    <input type="text" name="bth" size="20" value="2007-8-9" id="birthday"><input type="reset"  value="..." 
    onclick="return showCalendar('birthday','y-m-d');"></td></tr>
    <tr>
    <td width=‘40%’ align=center>&nbsp;地址:</td>
    <td>
    <select  name="province" onchange="updateCity(this.options[this.options.selectedIndex].value)" >
    <option value=01>北京      </option><option value=02>上海      </option><option value=03>重庆      </option><option value=04>浙江      </option><option value=05>广东      </option></select>
    <select name="city" multiple="multiple" size="1"></select>
    </td></tr>
    <tr>
    <td  ><input type="submit" name="submit" value="提交"></td>
    <td ><input type="reset" name="reset" value="重置"></td></tr>
    </tbody></table><br><br><br><br >
    </form>    </body>
    </html>
    提示65行缺少对象 即
    <select  name="province" onchange="updateCity(this.options[this.options.selectedIndex].value)" >
      

  2.   

    onchange="updateCity(this.options[selectedIndex].value)" 这样试试
      

  3.   

    发现缺少对象是由于javascript里的function 函数错误造成的
    请问各位大侠,这么实现连接数据库的 两级省市菜单
      

  4.   

    不刷新全页 只能AJAX实现吗
      

  5.   

    晕怎么里面有java啊?这错误可太低级了