EasyUI 關於 panel,window,dialog 通過href載入頁面,頁面中引用的js不執行的解決方案
阿新 • • 發佈:2018-12-23
詳細說明請參閱:http://www.jeasyuicn.com/post-49.html
href 指向的頁面不能是完整的html頁面,需要是不包含html,body,head標籤的html片段,
如
<link href="/resources/css/dhteumeuleu.css" rel="stylesheet" type="text/css"/> <button id="arrow_left" class="arrow"><</button> <div id="screen"></div> <button id="arrow_right" class="arrow">></button> <img id="loading" alt="" style="visibility: hidden"> <script type="text/javascript" src="/resources/js/common/dhteumeuleu.js"></script> <script type="text/javascript" src="/resources/js/images/list.js"></script>
因為程式碼實現是將獲取的html片段append到body中的,因此如同以下完整的html程式碼是不行的,根本不會載入head中的link和script.
<html> <head> <link href="/resources/css/dhteumeuleu.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="/resources/js/common/dhteumeuleu.js"></script> <script type="text/javascript" src="/resources/js/images/list.js"></script> </head> <body> <button id="arrow_left" class="arrow"><</button> <div id="screen"></div> <button id="arrow_right" class="arrow">></button> <img id="loading" alt="" style="visibility: hidden"> </body> </html>