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

javascript syntax error
这两天总是出现syntax error,头疼。
function co_changecolor(cur)
{
  if(cur.substring(0,3)=="co")
  {
  var rowid="r_"+cur;
  var curcheckbox=document.getElementById(cur);
  var currow=document.getElementById(rowid);
  if(curcheckbox.checked==true)
  {
  currow.style.backgroundColor='#bed4ff';
  currow.className='checkedrow';
  }
  else
  {
  currow.style.backgroundColor='';
  currow.className='';
  }
  }
}
红色的地方firebug给我报syntax error.
调用的地方绿色:
while($row=mysql_fetch_array($result))
{
 $temp="co".$row['roomname'];
 $rowid="r_".$temp;
echo "<tr id='".$rowid."' onclick='"."co_changecolor('".$temp."')'>";
 echo "<td><input type='checkbox' id='".$temp."' name='".$temp."' checked=true onclick='".'change_rdstatus("'.$row['roomname'].'")'."' class='"."checkedrow' /></td>";
   
  echo "<td><input type='checkbox' id='"."rd".$row['roomname']."' name='"."rd".$row['roomname']."' checked=true onclick=check_costatus('".$row['roomname']."') /></td>";  
  echo "</tr>";
}

------解决方案--------------------
javascript syntax error //是语法错误,可以用firebug来测试啊
------解决方案--------------------
echo "<tr id='".$rowid."' onclick='"."co_changecolor(\"".$temp."\")'>";