global_header.js(公共JS文件,文件内容如下)
document.write("<link rel='stylesheet' type='text/css' href='themes/default/easyui.css'>")
相当于在目的页面添加了一段“<link rel='stylesheet' type='text/css' href='themes/default/easyui.css'>”。
document.write("<link rel='stylesheet' type='text/css' href='themes/default/easyui.css'>");
document.write("<link rel='stylesheet' type='text/css' href='themes/icon.css'>");
document.write("<script type='text/javascript' src='jquery-1.8.0.min.js'></script>");
document.write("<script type='text/javascript' src='jquery.easyui.min.js'></script>");
basic.html(要引用的html文件)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JS公共模版测试</title>
<!-- JS模版 -->
<script type='text/javascript' src='global_header.js'></script>
</head>
<body>
<h2>Basic DataGrid</h2>
<table class="easyui-datagrid" title="Basic DataGrid" style="width:700px;height:250px" data-options="singleSelect:true,collapsible:true">
<thead>
<tr>
<th data-options="field:'itemid',width:80">Item ID</th>
<th data-options="field:'productid',width:100">Product</th>
<th data-options="field:'listprice',width:80,align:'right'">List Price</th>
<th data-options="field:'unitcost',width:80,align:'right'">Unit Cost</th>
<th data-options="field:'attr1',width:250">Attribute</th>
<th data-options="field:'status',width:60,align:'center'">Status</th>
</tr>
</thead>
</table>
</body>
</html>