有个js问题,可能是因为函数类型的不同导致的吧<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>测试js</title>
<script type="text/javascript"> //最好用type,不用language声明脚本,符合w3c标准,当然有可能不被老板浏览器所识别
<!--
function a()
{
alert(1);
}
a();
function a()
{
alert(2);
}
a();
a = function(){
alert(3);
}
a();
a = function(){
alert(4);
}
a();
function a()
{
alert(5);
}
a();
-->
</script>
</head><body>
</body>
</html>
这是我的源文件,执行后一次显示的是5 5 3 4 4,可能是因为调用直接function函数时就以最后一次声明的为主,然后其它赋值的就不是这样了,然后后来调用的也是以它为主了,谁能告诉我这两种函数有什么区别?分别有什么不同?多谢大侠