<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<script>f_say(1);</script>
<script>
function f_say(str) {
alert(str);
}
</script>
<script>f_say(2);</script>
</body>
</html>
运行结果:
2
可见:
<script>f_say(1);</script>
在前面并没生效,所以调用要放在后面。