【发布时间】:2013-11-28 00:51:09
【问题描述】:
我有一个母版页和一个 JS 文件,我在母版页中添加了指向 javascript 文件的链接,但是在使用母版页的任何页面上,JS 都不起作用。
我已经在一个单独的页面中单独尝试了代码并且它可以工作。
<head runat="server">
<title></title>
<link href="../styles/StyleSheet1.css" rel="stylesheet" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="../Scripts/Menu.js"></script>
<script type="text/javascript">
function openNewWin(url) {
var x = window.open(url, 'mynewwin', 'toolbar=no,directories=no,location=no,menubar=no,left=0,top=0,resizable=no,status=no');
x.focus();
}
</script>
</head>
菜单.JS:
$(function () {
//When opening the page all level 2 and level 3 items must be hidden.
$(function () {
hideitems();
})
function hideitems() {
$('h10').hide();
$('h11').hide();
$('h12').hide();
$('h13').hide();
}
//Financial Click
$('h7').click(function () {
hideitems();
$('h10').slideToggle();
$('h11').slideToggle();
$('h12').slideToggle();
});
//Container Click
$('h8').click(function () {
hideitems();;
$('h13').slideToggle();
});
})
【问题讨论】:
-
不工作怎么办?有什么错误吗?
-
仅供参考:您在点击处理程序中添加点击处理程序。这不是一个好主意。
-
没有错误,但功能不起作用。菜单项应该隐藏加载,然后您可以通过单击它们来修改它们,但它们什么也不做。
-
这可能是路径问题,在渲染的页面上查看源代码,找到创建的完整路径,然后将其剪切并粘贴到浏览器中.. 如果你得到 404,你知道路径错了
-
它不会在标记中创建路径,它只是 /Scripts/menu.js
标签: c# javascript jquery asp.net