Chrome的Javascript控制台中的意外标识符

时间:2015-03-13 06:09:23

标签: javascript

<div id="my-page" style="width:100%; height:640px; position: absolute;overflow-x:hidden !important;-webkit-overflow-scrolling:touch !important;" class="iframely-widget-container">
  <script>
    $("#my-page").html('<iframe style="
            top: 0 px; left: 0 px; width: 101 % ; height: 100 % ; position: absolute;
            " mozallowfullscreen="
            true " webkitallowfullscreen="
            true " allowfullscreen="
            true " src="
            http: //www.flipbeets.com/get-embedded-code/zimbabwecricket/p~1~2~1?slug-hash=HrFBx&default-tab=result&host=http%3A%2F%2Fcodepen.io" class="iframely-widget iframely-iframe" frameborder="0"></iframe>');
  </script>
</div>

Chrome浏览器的Javascript控制台中的意外标识符。

(注意,代码用this formatter整理。)

2 个答案:

答案 0 :(得分:2)

尝试将字符串引号修改为',如:

$("#my-page").html('<iframe style="t...></iframe>')

答案 1 :(得分:2)

您需要删除双引号&#34;。你不能在.html(&#34;&#34;)和样式定义中使用它。你应该和&#39;和&#34;在一起。

<div id="my-page" style="width:100%; height:640px; position: absolute;overflow-x:hidden !important;-webkit-overflow-scrolling:touch !important;" class="iframely-widget-container">
  <script>
    $("#my-page").html('<iframe style="
            top: 0 px; left: 0 px; width: 101 % ; height: 100 % ; position: absolute;
            " mozallowfullscreen="
            true " webkitallowfullscreen="
            true " allowfullscreen="
            true " src="
            http: //www.flipbeets.com/get-embedded-code/zimbabwecricket/p~1~2~1?slug-hash=HrFBx&default-tab=result&host=http%3A%2F%2Fcodepen.io" class="iframely-widget iframely-iframe" frameborder="0"></iframe>');
  </script>
</div>