Uncaught SyntaxError: Unexpected token ILLEGAL

I am receiving Uncaught SyntaxError: Unexpected token ILLEGAL in chrome with this code:

   var leftMiddleJS = 'function onmouseover() {
        document.getElementById("background").style.marginTop = "-135px"; 
        document.getElementById("background").style.marginLeft = "0px";
        document.getElementById("background").style.width = "760px";
        document.getElementById("background").style.height = "520px";
        document.getElementById("background").style.marginTop = "0";
        document.getElementById("background").style.marginLeft = "0";

        function click() { 
        document.getElementById("outsideContainer").style.marginTop = "0"; 
        document.getElementById("outsideContainer").style.marginLeft = "0"; 
        document.getElementById("outsideContainer").style.width = "300px"; 
        document.getElementById("outsideContainer").style.height = "250px"; 
        document.getElementById("insideContainer").style.marginTop = "-135px"; 
        document.getElementById("insideContainer").style.marginLeft = "0px"; }';

What is the problem with the code?


如果你想分配一个跨越多行的字符串 - 使用字符串延续:

var leftMiddleJS = 'function onmouseover() { 
        document.getElementById("background").style.marginTop = "-135px";  
        document.getElementById("background").style.marginLeft = "0px"; 
        document.getElementById("background").style.width = "760px"; 
        document.getElementById("background").style.height = "520px"; 
        document.getElementById("background").style.marginTop = "0"; 
        document.getElementById("background").style.marginLeft = "0"; 

        function click() { 
        document.getElementById("outsideContainer").style.marginTop = "0"; 
        document.getElementById("outsideContainer").style.marginLeft = "0"; 
        document.getElementById("outsideContainer").style.width = "300px"; 
        document.getElementById("outsideContainer").style.height = "250px"; 
        document.getElementById("insideContainer").style.marginTop = "-135px";  
        document.getElementById("insideContainer").style.marginLeft = "0px"; }';
链接地址: http://www.djcxy.com/p/45984.html

上一篇: 未捕获的SyntaxError:意外的令牌T

下一篇: 未捕获的SyntaxError:意外的令牌非法