日期:2014-05-16  浏览次数:20319 次

这段定义字符串变量代码错哪里?
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>";

这段定义字符串变量代码错哪里?





------解决方案--------------------
双引号里套双引号,里面的双引号 需要 转义


这里可以 用单引号
JScript code

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>";或者
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>';