87,922
社区成员
发帖
与我相关
我的任务
分享
<!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">
<head>
<script type="text/javascript" src="1.js"/>
<script type="text/javascript">
function fnTest(){
alert("show me second!");
}
</script>
</head>
<body>
<input type="button" value="clickMe" onclick="fnTest()"/>
</body>
</html>
function fnTest(){
alert("show me first!");
}
<!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">
<head>
<script type="text/javascript">
function fnTest(){
alert("show me second!");
}
</script>
<script type="text/javascript" src="1.js"/>
</head>
<body>
<input type="button" value="clickMe" onclick="fnTest()"/>
</body>
</html>
function fnTest(){
alert("show me first!");
}
function fnTest(){
alert("show me first!");
}
//相当于:
var fnTest = new Function("alert('show me first!')");
function fnTest(){
alert("show me second!");
}
//相当于:
var fnTest = new Function("alert('show me second!')");
//那么结果是:
var fnTest = new Function("alert('show me first!')");
var fnTest = new Function("alert('show me second!')");