if(document.getElementById("下拉框的ID").value==""){}
看看这样行不行,说实话感觉你的代码好拥挤,可以使用jquery来进行取值捏

解决方案 »

  1.   


    我们不能用jquery 。。
      

  2.   

    <tr> 
    <td width='10%' class="left">车价输出:</td>
    <td width='30%' class="right">
    <select id="priceKind" name="" >
    <option value="" ></option>
    <option value="newCarPrice" >新车购置价</option>
    <option value="newKindPrice" >类比价格</option>
    </select>
    </td>
    </tr>下拉框做了一个选择项,if(document.getElementById("priceKind").value=="newCarPrice"){
            window.opener.fm.PurchasePrice.value =  purchasePrice; 
    }else if(document.getElementById("priceKind").value=="newKindPrice"){
    window.opener.fm.PurchasePrice.value =  kindRedPriceTax;
    }else{
            window.opener.fm.CarActualValue.value =  carActualValue;
        window.opener.fm.PurchasePrice.value =  purchasePrice; 
        window.opener.fm.CarActualValueTrue.value =  purchasePrice; 我在js里做了一个判断,选择新车价就返回新车价,选择类比价就返回类比价,如果不选,按原代码走原代码<tr class="<%=trClass%>"
    onclick="submitForm('<%if(strPurchasePriceTaxComCode.indexOf(strComCode.substring(0,2))>-1){ %>
          ,'<%=new DecimalFormat("0.00").format(Double.parseDouble(prpDcarModelSchema.getPurchasePriceTax()))%>'
          ,'<%=new DecimalFormat("0.00").format(Double.parseDouble(prpDcarModelSchema.getPurchasePriceTax()))%>'
          <%}else{ %>
          ,'<%=new DecimalFormat("0.00").format(Double.parseDouble(prpDcarModelSchema.getPurchasePrice()))%>'
          ,'<%=new DecimalFormat("0.00").format(Double.parseDouble(prpDcarModelSchema.getPurchasePrice()))%>'
          <%} %>
    有一个根据机构的不同所返回的价钱不同。
      

  3.   

    用Jquery 或者 jstl 的标签取值啊,在jsp 里面写这么多java代码 太不好看了
      

  4.   

    首先要理解一点,jsp是服务器语言,js是客户端语言,在页面打开以后,jsp里面的代码已经执行了,生成了最终访问的html,你再用js是不能再处理jsp的代码,要想做一些需要jsp来做的处理,就用ajax把js的值传给另一个jsp页面来处理。可以学习一下ajax