主要代码如下: 功能是不同按钮提交不同页面.可是报错说ListItemForSale.action这一行对象不支持此属性或方法,我哪里错了吗 .<SCRIPT language=javascript>function GoTo(wheres,formname)
{
if(ListItemForSale.smallclassid.value=='0'){
alert("请输入你所要查询的城市!");
ListItemForSale.bigclassid.focus();
return false;}if(ListItemForSale.starttime.value==''){
alert("请选择入住日期!");
formnListItemForSaleame.starttime.focus();
return false;
}
if(ListItemForSale.deptime.value==''){
alert("请选择退房日期!");
ListItemForSale.deptime.focus();
return false;
}  
          switch(wheres)   
          {
                  case   'query':   
                          ListItemForSale.action="SearchResult.asp";   
                          ListItemForSale.submit();   
                          break;   
                  case   'insterdb':
  //alert('a');
                          ListItemForSale.action="chkhotel.asp";   
                          ListItemForSale.submit();   
                          break;   
 }
}
</SCRIPT>
上传到网页上的地址是 http://www.skotrip.com/hotel/index.asp ,麻烦大家看一下是什么问题

解决方案 »

  1.   

    "ListItemForSale"是一个form的名称吗?
    单纯从错误判断,"ListItemForSale"应该不是form对象,所以没有action这个属性。
      

  2.   

    formnListItemForSaleame.starttime.focus();
    错了吧formnListItemForSale.starttime.focus();
      

  3.   

    代码我精简了一下.这样还是出错!<SCRIPT language=javascript>function GoTo(wheresx)
    {
              switch(wheresx)   
              {
                      case   'query':   
                              htform.action=    "SearchResult.asp";   
                              htform.submit();   
                              break;   
                      case   'insterdb':
      alert('a');
                              htform.action=    "chkhotel.asp";   
                              htform.submit();   
                              break;   
     }
    }
    </SCRIPT> <form method="post" name="htform" action="flight/searching.asp" target="_blank">   <table>
         <tr>
    <td colspan="8"><font color="#666699">补充:</font><input type="text" name="cabinfo" class="inputclass2" id="cabinfo" value="如导游、度假、机票、租车方面需要" 
    onfocus="checkss(this,1,'如导游、度假、机票、租车方面需要')"
    onblur="checkss(this,2,'如导游、度假、机票、租车方面需要')" 
    onclick="checkss(this,0,'如导游、度假、机票、租车方面需要');" /></td>
    </tr>
        <tr> 
          <td colspan="8" align="center" style="padding-top:10px;"> 
            <input type="button" name="Submit" value="查询预定"  class="submitcolor" onClick="GoTo('query')"/>
            <input type="button" name="Submit2" value="直接提交" onClick="GoTo('insterdb')">
            <input type="hidden" name="action" value="chkhot" />
            <input type="reset" name="reset" value=" 重 置 " class="submitcolor"  />
          </td>
        </tr>
    </table>
      </form>
      

  4.   

    你有个hidden的name也是action,所以就出错了.