我有一个 html 文件,其中当前包含我的所有 javascript 代码。我想制作一个单独的 .js 文件,将所有 javascript 代码放入其中并将其包含在我的 .html 文件中。我试过这样做,还删除了 .js 文件中的开始/结束标签并将这一行放在 .html 文件中 -
<script type='text/javascript' src="myfile.js"></script>
但是,这是行不通的。关于有什么问题的任何想法?提前致谢。
- - - - - - - - - - -编辑 - - - - - - - - - - - - - - -
<html>
<title>Process Details</title>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="myfile.js">
</script>
<style type="text/css">
body { font-size: 80%; font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif; }
ul#tabs { list-style-type: none; margin: 30px 0 0 0; padding: 0 0 0.3em 0; }
ul#tabs li { display: inline; }
ul#tabs li a { color: #42454a; background-color: #dedbde; border: 1px solid #c9c3ba; border-bottom: none; padding: 0.3em; text-decoration: none; }
ul#tabs li a:hover { background-color: #f1f0ee; }
ul#tabs li a.selected { color: #000; background-color: #f1f0ee; font-weight: bold; padding: 0.7em 0.3em 0.38em 0.3em; }
div.tabContent { border: 1px solid #c9c3ba; padding: 0.5em; background-color: #f1f0ee; }
div.tabContent.hide { display: none; }
.heading { font-size:110%; font-family:'Century Schoolbook'; color: maroon; }
.data { font-size:110%; font-family:'Century Schoolbook'; color:black; }
</style>
</head>
<body onload="init()">
<center>
<font face='Calibri' size='3' color='Blue'>PID : </font>
<select id='list' onchange="refreshData()">
</select>
<form>
<input type="button" id="Refresh" onclick="refreshPage()" value="Refresh Data"/>
</form>
</center>
<ul id="tabs">
<li><a href="#memory">Memory</a></li>
<li><a href="#thread">Thread</a></li>
<li><a href="#summary">Summary</a></li>
</ul>
<div class="tabContent" id="memory">
<table id="graphtab" align="center">
<tr>
<td id="heap" align="center"></td>
<td id="nonheap" align="center"></td>
</tr>
<tr>
<td id="resident" align="center"></td>
<td id="pagefaults" align="center"></td>
</tr>
</table>
</div>
<div class="tabContent" id="thread">
<table id="threadtab" align="center">
<tr>
<td id="cpuusage" align="center"></td>
<td id="count" align="center"></td>
</tr>
<tr>
<td id="threadlist" align="center"></td>
<td id="threaddets" align="center"></td>
</tr>
</table>
</div>
<div class="tabContent" id="summary">
</div>
<a href="client.html">Home Page</a>
</body>
</html>