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

Unexpected Identifier in Chrome's Javascript console

本文关键字:意外 标识符 控制台 Javascript Chrome      更新时间:2023-09-26
<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 控制台中的意外标识符。

(注意,代码使用此格式化程序整理。

只是尝试将字符串引号修改为'如下:

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

您需要删除双引号 "。您也不能在 .html(") 和样式定义中使用它。您应该一起使用 ' 和 "。

<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>