日期:2014-05-16  浏览次数:20447 次

什么无法调用在同一级目录下的JAVASCRIPT
小弟是在校学生。。刚刚接触这样面。不明白问题出在来。。检测很多次了。

所有Javascript中定义的都无法调用

第一段是HTML中的:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  <meta http-equiv="Content-Language" content="zh-CN">
<title>标题党路过....</title>
<link rel="stylesheet" type="text/css" href="body.css">
<script type="text/javascript" src="js1.js"></script>
</head>
<body onload="hello()"> <!--/加载网页时自动执行/-->
<div class="body">
<div class="top">欢迎光临哔哩哔哩Bilibili</div>
<div class="centerL">
<center>会员积分排行榜:</center>
<table border="1">
<tr>
<td>第一名:22娘</td>
<td><input type="button" value="查询详情" onclick="alert('123')"></td>
</tr>
<tr>
<td>第二名:33娘</td>
<td><input type="button" value="查询详情" onclick="alert((new chaxun('33娘',386,841,3034)).toString())"></td>
</tr>
</table>
</div>
<div class="centerR">
<h2>这是主标题</h2>
<p>这里是主要内容区</p>
<p>......</p>
<input type="button" value="点击触发事件" onclick="buttons()">
</div>
<div class="foot">
<form name="denglu" method="get">
<center>帐 号:<input type="text" name="userId" value="">   密 码:<input type="password" name="userPwd" value="">   <input type="button" value="登陆" onclick="jiance()"></center>
</form>
</div>
  </div>
</body>
</html>
















第二段是Javascript中的

function hello()
{
alert("欢迎光临本站!");
}

function buttons()
{
alert("触发成功!");
}

function jiance()
{
if((document.denglu.userId.value) ==""){
alert("请输入帐号!");
  return false;
}
if((document.denglu.userPwd.value) ==""){
alert("请输入密码!");
  return false;
}
}

function chaxun(user,xiaofei,shipin,renqi){
this.user = user;
this.xiaofei = xiaofei;
this.shipin = shipin;
this.renqi =renqi;

this.sum = sum;
this.level = level;

this toSting = function toSting(){
var specifics = "会员:" + this.user + "\n";
var thesum = sum(this.xiaofei,this.shipin,this.renqi);

specifics += "消费获得积分:" + this.xiaofei + "\n";
specifics += "发布获得视频:" + this.shipin + "\n";
specifics += "视频点击获得积分:" + this.renqi + "\n";
return specifics;
}
}
function sum(){
var i ret =0;
for(i = 0;i<arguments.length;i++) {
ret += arguments[i];
}
return ret;
}


------解决方案-----------