我有一个html页面,对于学校我需要制作一个菜单栏。我想将其设置为本地,因此我决定将menu.html上传到media fire
menu.html
<html>
<body>
<nav class="navbar navbar-inverse"
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand">Practice</a>
</div>
<ul class="nav navbar-nav">
<li class="active"></li>
</div>
</nav>
</body>
我的页面不会加载此文件,输出中没有任何内容。
practiceblank.html
<html>
<head>
<title>Testing Webpage</title>
<link rel="stylesheet" href="bootstrap.min.css">
<link rel = "stylesheet" type = "text/css" href = "main.css"/>
<link rel='icon' href='favicon.ico' type='image/x-icon'/>
<script>
var clicks = 0;
cps = 1;
function countClicks() {
clicks += 1;
document.getElementById("clicks").innerHTML = clicks;
}
</script>
</head>
<body class="an1">
<div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
jQuery("#div1").load("http://download1473.mediafireuserdownload.com/feen32om7deg/ebw8k296r8caucm/menu.html");
</script>
<!--The rest is personal-->
答案 0 :(得分:1)
您应该将库的包含与脚本分开:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(function(){
jQuery("#div1").load("http://download1473.mediafireuserdownload.com/feen32om7deg/ebw8k296r8caucm/menu.html");
});
</script>
希望这有帮助。