Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/419.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JQuery行正在破坏我的页面_Javascript_Jquery_Debugging_Firefox - Fatal编程技术网

Javascript JQuery行正在破坏我的页面

Javascript JQuery行正在破坏我的页面,javascript,jquery,debugging,firefox,Javascript,Jquery,Debugging,Firefox,因此,我正在为我正在开发的一个站点开发一点jQuery,出于某种原因,当我在双引号Firefox中添加单引号时,在它的永恒荣耀中,将它们更改为双引号,从而破坏了我的代码 我甚至试着把它放在一个外部javascript文件中,尽管我现在只是在做原型。无益。不会加载文件 $("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piec

因此,我正在为我正在开发的一个站点开发一点jQuery,出于某种原因,当我在双引号Firefox中添加单引号时,在它的永恒荣耀中,将它们更改为双引号,从而破坏了我的代码

我甚至试着把它放在一个外部javascript文件中,尽管我现在只是在做原型。无益。不会加载文件

$("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piece'>Next</a></li><li><a id='gallery-prev' href='#' title='View the previous piece'>Prev</a></li></ul>");
$(“#clips”)。在(
    • )之后;

我做错什么了吗?

你试过切换单引号和双引号吗

$("#clips").after('<ul id="slideshow-nav"><li><a id="gallery-next" href="#" title="View the next piece">Next</a></li><li><a id="gallery-prev" href="#" title="View the previous piece">Prev</a></li></ul>');
$(“#剪辑”)。在('ul id=“slideshow nav”>
    • '之后);
  • 您是否尝试过切换单引号和双引号

    $("#clips").after('<ul id="slideshow-nav"><li><a id="gallery-next" href="#" title="View the next piece">Next</a></li><li><a id="gallery-prev" href="#" title="View the previous piece">Prev</a></li></ul>');
    
    $(“#剪辑”)。在('ul id=“slideshow nav”>
    • '之后);
  • 您是否考虑过:-

    $("#clips").after('<ul id="slideshow-nav"><li><a id="gallery-next" href="#" title="View the next piece">Next</a></li><li><a id="gallery-prev" href="#" title="View the previous piece">Prev</a></li></ul>')
    
    $(“#剪辑”)。之后(“
    • /ul>”)
    ?

    虽然在Javascript中使用“可交换的用法”和“可交换的用法”在HTML/XML中定义属性值是很正常的,但很少使用“的用法”来分隔属性值。

    您是否考虑过:-

    $("#clips").after('<ul id="slideshow-nav"><li><a id="gallery-next" href="#" title="View the next piece">Next</a></li><li><a id="gallery-prev" href="#" title="View the previous piece">Prev</a></li></ul>')
    
    $(“#剪辑”)。之后(“
    • /ul>”)
    ?


    虽然在Javascript中使用“和”可交换的用法在HTML/XML中使用“来限定属性值是很正常的,但在FF3.5中我无法重现这个错误

    <div id="clips">test</div>
    <script type="text/javascript">
      $("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piece'>Next</a></li><li><a id='gallery-prev' href='#' title='View the previous piece'>Prev</a></li></ul>");
    </script>
    
    测试
    $(“#剪辑”)。在(
      • 之后);
    给我:

    <div id="clips">test</div>
    <ul id="slideshow-nav">
      <li><a title="View the next piece" href="#" id="gallery-next">Next</a></li>
      <li><a title="View the previous piece" href="#" id="gallery-prev">Prev</a></li>
    </ul>
    
    测试
    

    我无法重现FF3.5中的错误

    <div id="clips">test</div>
    <script type="text/javascript">
      $("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piece'>Next</a></li><li><a id='gallery-prev' href='#' title='View the previous piece'>Prev</a></li></ul>");
    </script>
    
    测试
    $(“#剪辑”)。在(
      • 之后);
    给我:

    <div id="clips">test</div>
    <ul id="slideshow-nav">
      <li><a title="View the next piece" href="#" id="gallery-next">Next</a></li>
      <li><a title="View the previous piece" href="#" id="gallery-prev">Prev</a></li>
    </ul>
    
    测试
    

    在FF 3.5.2中对我来说很好。是否将其包装为$(函数(){});要确保加载DOM

    <html>
    <head>
    <title>tt</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
    <script type="text/javascript">
        $(function() {
             $("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piece'>Next</a></li><li><a id='gallery-prev' href='#' title='View the previous piece'>Prev</a></li></ul>");
        });
    </script>
    </head>
    
    <body>
    <div id='clips'></div>
    </body>
    </html>
    
    
    tt
    $(函数(){
    $(“#剪辑”)。在(
      • 之后); });
    在FF 3.5.2中对我来说很好。是否将其包装为$(函数(){});要确保加载DOM

    <html>
    <head>
    <title>tt</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
    <script type="text/javascript">
        $(function() {
             $("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piece'>Next</a></li><li><a id='gallery-prev' href='#' title='View the previous piece'>Prev</a></li></ul>");
        });
    </script>
    </head>
    
    <body>
    <div id='clips'></div>
    </body>
    </html>
    
    
    tt
    $(函数(){
    $(“#剪辑”)。在(
      • 之后); });
    看起来不错。有几件事可以尝试:

    为可读性而重新构造(是相同的代码,使用末尾带有.join(“”)的数组):

    $(“剪辑”)
    .在([
    “
      ”, “
    • ”, “
    • ”, “
    ” ].加入(“”) );
    重命名ID只是为了确保页面上没有冲突(通常有奇怪的错误):

    $(“剪辑”)
    .在([
    “
      ”, “
    • ”, “
    • ”, “
    ” ].加入(“”) );
    使用带转义字符的所有双引号:

    $("#clips")
    .after( [
       "<ul id=\"slideshow-nav2\">",
           "<li><a id=\"gallery-next2\" href=\"#\" title=\"Next piece\">Next</a></li>",
           "<li><a id=\"gallery-prev2\" href=\"#\" title=\"Previous piece\">Prev</a></li>",
       "</ul>"
    ].join('')
    );
    
    $(“剪辑”)
    .在([
    “
      ”, “
    • ”, “
    • ”, “
    ” ].加入(“”) );
    看起来不错。有几件事可以尝试:

    为可读性而重新构造(是相同的代码,使用末尾带有.join(“”)的数组):

    $(“剪辑”)
    .在([
    “
      ”, “
    • ”, “
    • ”, “
    ” ].加入(“”) );
    重命名ID只是为了确保页面上没有冲突(通常有奇怪的错误):

    $(“剪辑”)
    .在([
    “
      ”, “
    • ”, “
    • ”, “
    ” ].加入(“”) );
    使用带转义字符的所有双引号:

    $("#clips")
    .after( [
       "<ul id=\"slideshow-nav2\">",
           "<li><a id=\"gallery-next2\" href=\"#\" title=\"Next piece\">Next</a></li>",
           "<li><a id=\"gallery-prev2\" href=\"#\" title=\"Previous piece\">Prev</a></li>",
       "</ul>"
    ].join('')
    );
    
    $(“剪辑”)
    .在([
    “
      ”, “
    • ”, “
    • ”, “
    ” ].加入(“”) );
    嗯,这对我有用吗


    嗯,这对我有用吗


    单引号和双引号在JavaScript和HTML中均有效:

    HTML: “”

    JavaScript: “”


    单引号和双引号在JavaScript和HTML中均有效:

    HTML: “”

    JavaScript: “”