2014-12-07 58 views
0

我的jquery不能在任何浏览器中工作我在网上找到了许多答案,因为它没有帮助我出来.. !!我的jquery代码不能在任何浏览器中运行

这是我在索引文件我在这两个 (的index.html)和(的index.php)

<!doctype html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 
<title>Jquery</title> 
</head> 
<body> 
<div id="message" style="display:none;"> Welcome to my site</div> 
<script type="text/javascript" src="js/jquery.js"></script> 
<script type="text/javascript" src="js/fade.js"></script> 

</body> 
</html> 

JavaScript文件是在JS文件夹试图代码 。

而且fade.js代码为: -

$(document).ready(function() { 
$('#message').fadeIn('slow'); 
}); 

和jQuery代码,是我从jQuery的网站下载 我试图制作两个版本1个2 以及其他源链接像

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> 

还有一些用户使用的jQuery源代码链接。 我也尝试将脚本代码移到标签上方。 但无论它是我尝试不在任何浏览器工作。

请帮我一臂之力!

+0

你需要换剧本。 jQuery必须先加载。将头部和拼写功能都放在正确的位置 – mplungjan 2014-12-07 10:02:24

+0

从这里复制代码并将其粘贴到文档中,看看它是否可用:http://jsfiddle.net/11nonnea/。 – gothical 2014-12-07 10:28:54

回答

3

fucntion应该是function &在脚本之前加载jQuery

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> 
$(document).ready(function() { 
        /*^^^^^^*/ 
    $('#message').fadeIn('slow'); 
}); 
+1

斑点...但jQuery也需要加载之前使用 – mplungjan 2014-12-07 10:05:11

+0

oops我得到了一个错字thanx但仍然编辑后仍然没有得到 – 2014-12-07 10:16:54

1

你必须加载jQuery的您尝试调用它提供的功能之前。交换脚本标记的顺序。

然后看看你的JavaScript错误控制台。它会抱怨你的拼写错误functionfucntion

+1

随着你的代表你也可以关闭。不值得一个答案 – mplungjan 2014-12-07 10:07:19

+0

雅我更正fucntion和交换脚本仍然不开放在我的浏览器:( – 2014-12-07 10:17:52

0

只是复制/粘贴此:

<!doctype html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 
<title>Jquery</title> 


<script type="text/javascript" src="js/jquery.js"></script> 
<script> 
$(document).ready(function() { 
$('#message').fadeIn('slow'); 
}); 
</script> 
</head> 

<body> 

<div id="message" style="display:none;"> Welcome to my site</div> 

</body> 
</html> 
+0

它不工作时,我对外添加它请帮助我.. !! – 2014-12-07 10:40:55

+0

@sagarkargathra你想添加脚本在外部js文件?你还有其他文件吗?或者只是这个脚本? – Alin 2014-12-07 10:43:17

相关问题