我想在里面加载一个 html 文件(“hello_world.html”)
另一个 html 页面(“index.html”)这两个文件位于同一位置。
这是我写的代码。但它没有加载任何东西。
两个警报都有效(我故意发出来检查是否
jquery 是否工作。没有其他用途)
代码中有什么错误?我不想使用ajax。
</head>
<script type="text/javascript" src="../jquery-1.3.2.js"></script>
<script type="text/javascript">
$("document").ready(function() {
alert("ya loaded");
$('#container').load('hello_world.html');
alert("finished");
});
</script>
</head>
<body>
<div id="container">
</div>
</body>
好吧,我在一个目录中有以下文件:
你好世界.html
<p>hello!</p>
测试.html
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
$("document").ready(function() {
$('#container').load('helloworld.html');
});
</script>
</head>
<body>
<div id="container"></div>
</body>
</html>
在浏览器中加载 test.html 会产生“hello!”,因此请检查 jQuery 是否已正确加载。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)