0

我正在尝试为倒计时插件使用完成功能;但是,无论出于何种原因,dreamweaver 告诉我存在语法错误,我告诉它更改 div 内容容器的内部 HTML。我一直在寻找几个小时,找不到它有什么问题。我希望有人可以帮助我。任何帮助表示赞赏。

<script language="javascript" type="text/javascript">
            jQuery(document).ready(function() {
                $('#countdown_dashboard').countDown({
                    targetOffset: {
                        'day':      0,
                        'month':    0,
                        'year':     0,
                        'hour':     0,
                        'min':      5,
                        'sec':      0
                    },
                    onComplete: function() { 
                    document.getElementById('contentcontainer').innerHTML = '<div id="content">
  <div class="success_box">Application Successful!  Redirecting...</div>
    <div class="error_box"></div>
  <div class="formcontainer">
  <form id="formexample" name="example_form" action="#" method="POST">
        <label for="firstname">*First Name:</label>
        <label for="lastname">*Last Name:</label>

      <input name="firstname" id="firstname" />
      <input name="lastname" id="lastname" />

        <label for="username">*Username:</label>
        <label for="email">*Email (A Confirmation Email Will Be Sent Here) :</label>

        <input onKeyPress="makeithappen()" onKeyUp="makeithappen()" name="username" id="username" />
        <input onKeyPress="makeithappenemail()" onKeyUp="makeithappenemail()" name="email" id="email" />

        <label for="password">*Password:</label>
        <label for="password_confirm">*Confirm Password:</label>

        <input onKeyPress="makeithappenemail()" onKeyUp="makeithappenemail()" name="password" id="password" type="password" />
        <input onKeyPress="makeithappen()" onKeyUp="makeithappen()" name="password_confirm" id="password_confirm" type="password" />

    <button class="button gray" type="submit" name="submit">Submit  </button> 
    <input id="usernameused" name="usernameused" type="hidden" value=""> 
    <input id="emailused" name="emailused" type="hidden" value="">
  </form>
  </div>
</div>';
                    }

                });
            });
        </script>
<div id="contentcontainer">
</div>
4

1 回答 1

2

你的问题是你有一个打开的字符串。Javascript 不支持带有单 (') 或双 (") 引号的多行字符串。

换句话说

var d = "hello
world "

无效,但是,您可以使用特殊字符 \ 来“使用”或“转义”换行符并使其像单行字符串一样工作。

var d = "hello \
world " 

希望这可以帮助!

于 2013-04-05T06:40:47.997 回答