天天看点

EasyUI 关于 panel,window,dialog 通过href加载页面,页面中引用的js不执行的解决方案

详细说明请参阅:http://www.jeasyuicn.com/post-49.html

href 指向的页面不能是完整的html页面,需要是不包含html,body,head标签的html片段,

<link href="/resources/css/dhteumeuleu.css" target="_blank" rel="external nofollow"  target="_blank" rel="external nofollow"  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" target="_blank" rel="external nofollow"  target="_blank" rel="external nofollow"  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>
           

继续阅读