var abc="This is a \n good question!";
alert(abc);

解决方案 »

  1.   

    可是我的代码是动态生成的,只能跨行,请问有没有象VBScript那样的接行符“_“那样的功能?
      

  2.   

    var abc="This is a "
      +"n good question!";
    alert(abc);
      

  3.   

    <body>
    <textarea style="display:none" id=t>This is a 
    good question!</textarea>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    alert(t.value)
    //-->
    </SCRIPT>
      

  4.   

    <script>
    alert("a" +
    "b");
    alert("a"
    + "b");
    </script>