我有一个问题,我的 javascript 不能在单独的文件中工作,但它可以内联工作。
这是我的 javascript 的工作代码。这是在 asp.net 4.0 中。
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="FrontEnd.master.cs" Inherits="pigninja.FrontEnd" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript">
function ShowItem(itemID) {
document.getElementById(itemID).style.visiblity = "visible";
}
function HideItem(itemID) {
document.getElementById(itemID).style.visiblity = "hidden";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Pigninja Paradox</title>
<link href="../Styles/Styles.css" rel="Stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div id="pageWrapper">
<div id="header">
</div>
<div id="navigation">
<div id="menu">
<ul>
<li><a href="../Default.aspx">Home</a></li>
<li><a href="../About.aspx">About Me</a>
<div id="submenu">
<ul>
<li onmouseout="HideItem('submenu');" onmouseover="ShowItem('submenu');"><a href="1983.aspx">
1983</a></li>
<li><a href="1988.aspx">1988</a></li>
<li><a href="1990s.aspx">1990's</a></li>
<li><a href="2000.aspx">2000</a></li>
<li><a href="present.aspx">Present</a></li>
</ul>
</div>
</li>
<li><a href="../Programming.aspx">Programming</a></li>
<li><a href="../Rants.aspx">Rants</a></li>
</ul>
</div>
</div>
<div id="content">
<asp:ContentPlaceHolder ID="Content" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="footer">
<p>
I'd rather be an outlaw then to fall to Babylon law</p>
</div>
</div>
</form>
</body>
</html>
问题是一旦我将其更改为
<script language="javascript" type="text/javascript" src="../scripts/navBarScript.js"> </script>
我的代码不再有效,我终其一生都无法弄清楚原因。