我有一个 HTML 文件,其中有一个简单的 jQuery 高亮效果。
这很好用。但是,当我将文件的扩展名从 .html 更改为 .php 并将其上传到我的服务器时,它不起作用。
它不起作用,我的意思是它没有突出显示 Div。
代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<style>
div {
width: 100px;
height: 100px;
}
</style>
<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 type="text/javascript" src="hflip.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div id="counter"></div>
<form>
<input name="ajaxlink" type="button" id="ajaxlink" class="ajaxlink" />
</form>
<script>
$( '#ajaxlink' ).click(function() {
$( "#counter" ).effect( "highlight", "slow" );
});
</script>
</body>
</html>
我做错了什么?为什么它在 HTML 文件中工作正常而在 .PHP 文件中却不能?
最佳答案
没有<body>
(开放标签)。并两次包含 jquery
关于javascript - jQuery 只能在 .html 文件中工作,而不能在 .PHP 文件中工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19159669/