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

javascript变量赋值el表达式出错



var tttt=document.getElementById("tuodongqun");
tttt.innerHTML="${innerContent}";




报错missing ; before statement


浏览器查看源文件后发现,这一行变成了

var tttt=document.getElementById("tuodongqun");
tttt.innerHTML="<div style="left: 338px; top: 69px; position: absolute; width: 152px; height: 114px;" class="drag" id="dragDiv1"><div><img src="jsp/jiantou1.png" id="jiantou" class="jiantou"></div><div class="rRightDown" id="rRightDown1"></div><div class="rLeftDown" id="rLeftDown1"></div><div class="rRightUp" id="rRightUp1"></div><div class="rLeftUp" id="rLeftUp1"></div><div class="rRight" id="rRight1"></div><div class="rLeft" id="rLeft1"></div><div class="rUp" id="rUp1"></div><div class="rDown" id="rDown1"></div></div><div style="left: 49px; top: 345px; position: absolute; width: 214px; height: 121px;" class="drag" id="dragDiv2"><div><img src="jsp/jiantou1.png" id="jiantou" class="jiantou"></div><div class="rRightDown" id="rRightDown2"></div><div class="rLeftDown" id="rLeftDown2"></div><div class="rRightUp" id="rRightUp2"></div><div class="rLeftUp" id="rLeftUp2"></div><div class="rRight" id="rRight2"></div><div class="rLeft" id="rLeft2"></div><div class="rUp" id="rUp2"></div><div class="rDown" id="rDown2"></div></div><div style="left: 496px; top: 223px; position: absolute;" class="drag" id="dragDiv3"><div><img src="jsp/jiantou1.png" id="jiantou" class="jiantou"></div><div class="rRightDown" id="rRightDown3"></div><div class="rLeftDown" id="rLeftDown3"></div><div class="rRightUp" id="rRightUp3"></div><div class="rLeftUp" id="rLeftUp3"></div><div class="rRight" id="rRight3"></div><div class="rLeft" id="rLeft3"></div><div class="rUp" id="rUp3"></div><div class="rDown" id="rDown3"></div></div>";


那一串东西是我保存在数据库的东西,不知道错在哪里

------解决方案--------------------
tttt.innerHTML="${innerContent}";改成:tttt.innerHTML='${innerContent}';