2015-03-13 26 views
1
<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控制檯中的意外標識符。Chrome的Javascript控制檯中的意外標識符

(注意,代碼整理了this formatter

+0

Ouch。 1班輪?請格式化您的代碼。 – Raptor 2015-03-13 06:11:14

+0

您能否解釋錯誤,而不僅僅是「意外標識符」? – 2015-03-13 06:25:23

回答

2

只是嘗試修改字符串引號'像:

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

其工作感謝@ kyriosli – Chan 2015-03-13 06:17:51

2

您需要刪除雙引號」你不能在使用它.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>