<sclect id="selcity">
 <script type="text/javascript" language="javascript">
if(<%=account.province%>.equals("湖南")){
document.write("<option value="+<%=account.province%>+" selected=selected>湖南</option>");

}
</script>
</sclect>
这个为什么输不出来,请高人指点.

解决方案 »

  1.   

    (<%=account.province%>.equals("湖南"))这里应该相等的<select></select>
    中不可以输出
    <script></script>
      

  2.   

    <select class="kuang" id="ChinaCity" style="WIDTH: 70px" onchange="selectcity(this.options.selectedIndex)" size="1" name="ChinaCity"  onblur="citychoose()">
                   
                      
                      <script type="text/javascript" language="javascript">
    if(<%=account.province%>.equals("湖南")){
     document.write("<option value="+<%=account.province%>+" selected=selected>湖南</option>");
    }
    </option>
                      </script>
    </select>中option输不出来是什么原因
      

  3.   

    既然都这样了为什么不用服务端的代码呢?<%= (account.province=="湖南"?"<option value="+account.province+" selected=selected>湖南</option>":""%>
    如果非要那样的话
    你的问题现在是 select中不能嵌套script标签
      

  4.   

    <script type="text/javascript" language="javascript">
    <%if(account.province.equals("湖南")){%>
    document.write("<option value="+'<%=account.province%>'+" selected=selected>湖南</option>");
    <%}%>
    </script>
      

  5.   

    if("<%=account.province%>"=="湖南")
      

  6.   

    account.province这个值是多少,你打印出来先看看。
      

  7.   

    估计你 的account.province是湖南,而不是"湖南"
    没有引号导致出错吧。、
    试一试‘<%=account.province%>’
      

  8.   

    试下
    <select id="selcity">
    </select>
    <script type="text/javascript" language="javascript">
    if("<%=account.province%>"==("湖南")){
    var str = "option value='"+<%=account.province%>+"' selected=selected>湖南</option>";
    document.getElementById("selcity").innerHtml=str;
    }
    </script>
      

  9.   

    account.province估计是没值吧。。