初学Javascript做了个测试就是提示缺少对象,请告诉我错在哪里?
helloworld.html
<html>
<head>
<title>Example HTML Page </title>
</head>
<body>
<input type="button" value="点击我" onclick="sayHello()">
<script type="text/javascript" src="example1.js"></script>
</body>
</html>
example1.js
<script typt="text/javascript">
function sayHello(){
alert("Hello Javascript"); }
</script>
helloworld.html
<html>
<head>
<title>Example HTML Page </title>
</head>
<body>
<input type="button" value="点击我" onclick="sayHello()">
<script type="text/javascript" src="example1.js"></script>
</body>
</html>
example1.js
<script typt="text/javascript">
function sayHello(){
alert("Hello Javascript"); }
</script>
example1.js
这两个文件放在一起吗?可能是路径找不到吧。
alert("Hello Javascript");}
<script type="text/javascript" src="example1.js"></script> //这个js是在同一文件下吗?
</body>
</html>
<script typt="text/javascript">
function sayHello(){
alert("Hello Javascript");
}
</script>