var tt = "<table width="200" border="0" height="65">
   <tr>
     <th height="33" colspan="2" scope="row">查找</th>
   </tr>
   <tr>
     <th width="110" scope="row"><input type="text" /></th>
     <th width="74"  height="33"scope="row"><input type="button" value="确定" size="20" /></th>
   </tr>
</table>";这段定义字符串变量代码错哪里?   

解决方案 »

  1.   

    双引号里套双引号,里面的双引号 需要 转义
    这里可以 用单引号var tt = '<table width="200" border="0" height="65"><tr><th height="33" colspan="2" scope="row">查找</th></tr><tr><th width="110" scope="row"><input type="text" /></th><th width="74" height="33"scope="row"><input type="button" value="确定" size="20" /></th></tr></table>';
      

  2.   

    var tt = "<table width='200' border='0' height='65'>
      <tr>
      <th height='33' colspan='2' scope='row'>查找</th>
      </tr>
      <tr>
      <th width='110' scope='row'><input type='text' /></th>
      <th width='74' height='33' scope='row'><input type='button' value='确定' size='20' /></th>
      </tr>
    </table>";或者
    var tt = '<table width="200" border="0" height="65">
      <tr>
      <th height="33" colspan="2" scope="row">查找</th>
      </tr>
      <tr>
      <th width="110" scope="row"><input type="text" /></th>
      <th width="74" height="33"scope="row"><input type="button" value="确定" size="20" /></th>
      </tr>
    </table>';