<html>
<head>
<meta name="generator"
content="HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" />
<title></title>
<script type="text/javacript" src="https://github.com/Clouda-team/baiducdnstatic/tree/master/libs/jquery/1.10.0/jquery.js">
</script>
<script type="text/javacript" >
/*
1.
--------------
window.onload = function(){
function change(){
alert(1);
}
}
*/
/*
2.
----------------
$(document).ready(function(){
function change(){
alert(1);
}
});
*/
/*
3.
---------------
function change(){
alert(1);
}
*/
</script>
</head>
<body>
<!-- 4 ..
<script type="text/javascript">
function change(){
console.log("a1");
}
</script>
-->
<button id="a1" onclick="change();" >aa</button>
<button id="b">bb</button>
<!--
5.
-----
<script type="text/javascript">
function change(){
console.log("a1");
}
</script>
-->
</body>
</html>
下面说明一下,在head标签中的js代码都不好使,只有在body标签下面的才可以,也就是1,2,3都不好使,4,5可以使,而我想把js代码放到head标签中,请问有什么办法,还有为什么在1,2,3这些情况下都不好使?
你检查一下
<script type="text/javacript" src="https://github.com/Clouda-tea...
2.<script type="text/javacript" >
这两句话 有没有错误