<input name="sch" type="text" id="sch" class="find" value="搜索" onfocus="sch()" onblur="schlose()" />
当我在body里面加上form后就出错,对象不支持此属性或方法。
去掉form后就没有问题。

解决方案 »

  1.   

    sch,schlose这两个方法怎么写的?
      

  2.   

    function sch()
    {
       document.form1("sch").value="";
    }
    function schlose()
    {
    if(document.getElementById("sch").value == "")
    {
    document.getElementById("sch").value = "搜索";
    }
    }
      

  3.   

        function sch()
        {
           document.getElementById("sch").value="";
        }
      

  4.   

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <link rel="stylesheet" type="text/css" href="Ehome.css">
    <style type="text/css">
    <!--
    .STYLE4 {color: #838383}
    .STYLE5 {color: #3A494B}
    -->
    </style>
    </head>
    <script type="text/javascript">
    function sch()
    {
    document.getElementById("sch").value = "";
    }
    function schlose()
    {
    if(document.getElementById("sch").value == "")
    {
    document.getElementById("sch").value = "搜索";
    }
    }
    function menu(id)
    {
    for(i=1;i<8;i++)
    {
    if(i == id)
    {
    document.getElementById("tbl"+i).style.display = 'block';
    document.getElementById("td"+i).innerHTML="<img src='WEB/tag.gif'/>"
    }
    else
    {
    document.getElementById("tbl"+i).style.display = 'none';
    document.getElementById("td"+i).innerHTML="";

    }
    }
    }
    function pattern()
    {
    for(i=1;i<8;i++)
    {
    document.getElementById("tbl"+i).style.display = 'none';
    }
    }   
    </script>
    <body topMargin=0 onload="pattern()">
    <form>
    <table width="986" height="38" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="400"><span class="STYLE4">品质生活 - 爱家无限</span></td>
        <td>&nbsp;</td>
        <td align="right"><table width="200" height="20" border="0" cellpadding="0" cellspacing="0" style="margin-top:8px">
          <tr>
            <td width="65" align="left"><a href="javascript:window.external.AddFavorite('http://www.mstarroom.com','智能家居')">加入收藏</a></td>
            <td width="65" align="left"><a onclick="this.style.behavior='url(#default#homepage)';this.sethomepage('http://www.mstarroom.com');return" 
    href="http://www.mstarroom.com/" false;="false;">设为首页</a></td>
            <td width="20" align="left" valign="top"><img src="WEB/home.gif" width="16" height="15"/></td>
            <td width="50" align="right"><a href="#">控制后台</a></td>
          </tr>
        </table>      <A href="javascript:window.external.AddFavorite('http://www.mstarroom.com','智能家居')"></A> <A onclick="this.style.behavior='url(#default#homepage)';this.sethomepage('http://www.mstarroom.com');return" 
    href="http://www.mstarroom.com/" false;="false;"></A><a href="#">&nbsp;</a></td>
      </tr>
    </table>
    <table width="980" height="53" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:20px">
      <tr>
        <td width="25"><img src="WEB/navigation_1.gif" width="25" height="53" /></td>
        <td width="116" background="WEB/navigation_2.gif" class="logo">&nbsp;</td>
        <td width="648" background="WEB/navigation_2.gif"><table width="648" height="30" border="0" cellpadding="0" cellspacing="0" class="head" style="margin-top:20px">
            <tr>
              <td width="44" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(1)">&nbsp;</td>
              <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(1)">关于爱得屋</td>
              <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(2)">新闻中心</td>
              <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(3)">产品系列</td>
              <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(4)">解决方案</td>
              <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(5)">项目展示</td>
              <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(6)">销售网络</td>
              <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(7)">客服服务</td>
              <td width="44" height="18" align="center" valign="top">&nbsp;</td>
            </tr>
            <tr>
              <td width="44" align="center"></td>
              <td align="center" id="td1"></td>
              <td align="center" id="td2"></td>
              <td align="center" id="td3"></td>
              <td align="center" id="td4"></td>
              <td align="center" id="td5"></td>
              <td align="center" id="td6"></td>
              <td align="center" id="td7"></td>
              <td width="44" align="center">&nbsp;</td>
            </tr>
          </table>
        </td>
        <td width="22"><img src="WEB/navigation_3.gif" width="22" height="53" /></td>
        <td width="143" background="WEB/navigation_4.gif"><table width="113" height="20" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="112" height="30" valign="bottom"><input id="sch" name="sch" class="find" value="搜索" onfocus="sch()" onblur="schlose()"/></td>
          </tr>
          <tr>
            <td height="10">&nbsp;</td>
          </tr>
        </table></td>
        <td width="25"><img src="WEB/navigation_5.gif" width="25" height="53" /></td>
      </tr>
    </table>
    </form>
    </body>
    </html>
      

  5.   

    document.getElementById("tbl"+i).style.display = 'none';
    是不是这句的问题??
      

  6.   

    你那个id为sch的input 没得type啊
      

  7.   

    和这个没关系,你测试搜索框,加form和不加form。
      

  8.   

     document.getElementById("tbl"+i).style.display = 'none';
    有错,缺少对象
      

  9.   

     <input id="sch" name="sch" class="find" value="搜索" onfocus="sch()" onblur="schlose()"/> 有错,type='text' 属性少了
      

  10.   

    下面的内容没贴出来,太长了,原因不在这里,你可以删掉function menu(id)
    和pattern(),然后只看搜索框
      

  11.   

    不是这的原因,加上type='text'和没加一样
      

  12.   


    function sch1()
        {
            document.getElementById("sch").value = "";
        }<input id="sch" name="sch" class="find" value="搜索" onfocus="sch1()" onblur="schlose()"/>