问题描述
有人能告诉我为什么这个剧本不起作用吗?我在
页面消息上收到错误消息。谢谢。
< html>
< head>
< meta http-equiv =" ;内容语言与QUOT; content =" en-us">
< meta http-equiv =" Content-Type" content =" text / html;
charset = windows-1252">
< title>新页面1< / title>
< script language =" javascript">
<! - 开始
var userData = new Array()
userData [] = new Array(sbazell,0513,Agent Bonus / aknram.htm);
userData [] = new Array(" techambers" ,Chambers1,Agent
Bonus / xplojh.htm);
userData [] = new Array(" afrye"," AJPMF1998", Agent Bonus / yxjgrv.htm);
userData [] = new Array(thead,Blessed07,Agent Bonus / jnsihy.htm);
userData [] = new Array(cryjohnson,kittycat6,Agent
Bonus / xdowud.htm);
userData [] = new Array(rckenley,Baller,Agent Bonus / vxjuye.htm);
userData [] = new Array(" nmock&quo t;,Dimonds4ever,Agent
Bonus / zzojkl.htm);
userData [] = new Array(" gnimley"," Qwejue" ;,Agent Bonus / hsoywm.htm);
userData [] = new Array(" vestewart"," TD3301"," Agent
Bonus /muedjk.htm");
userData [] = new Array(" jthrelfall"," jeff1"," Agent
Bonus / uehdlo.htm") ;
函数登录(){
var username = document.login.username.value.toLowerCase();
var username = document.login.password.value.toLowerCase();
for(i = 0; I< userData.length; i ++){
if(username == userData [i] [0]&& password == userData [i] [1]){
window.open (userData [i] [2]);
返回true;
}
}
alert(" ;无效登录!");
}
//结束 - >
< / script>
< meta name =" Microsoft Theme" content =" boldstri 1011,default">
< meta name =" Microsoft Border" content =" t,default">
< / head>
< body>
< center> ;
< form name = login>
< table width = 225 border = 1 cellpadding = 3>
< tr>< ; td colspan = 2>< center>< font size =" + 2">< b> Bombers Only
Area!< / b>< / font>< / center>< / td>< / tr>
< tr>< td>用户名:< / td>< td><输入类型=文字名称=用户名> < / td>< / tr>
< tr>< td>密码:< / td>< td><输入类型=密码名称=密码
size =" 20">< / td>< / tr>
< tr>< td colspan = 2 align = center>< input type = button value ="给我看看
Money! onClick =" Login()">< / td>< / tr>
< / table>
< / form>
< / center>
< / body>
< / html>
Can someone tell me why this script isn''t working? I get an error on
page message. Thanks.
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>New Page 1</title>
<script language="javascript">
<!-- Begin
var userData = new Array()
userData[] = new Array("sbazell", "0513", "Agent Bonus/aknram.htm");
userData[] = new Array("techambers", "Chambers1", "Agent
Bonus/xplojh.htm");
userData[] = new Array("afrye", "AJPMF1998", "Agent Bonus/yxjgrv.htm");
userData[] = new Array("thead", "Blessed07", "Agent Bonus/jnsihy.htm");
userData[] = new Array("cryjohnson", "kittycat6", "Agent
Bonus/xdowud.htm");
userData[] = new Array("rckenley", "Baller", "Agent Bonus/vxjuye.htm");
userData[] = new Array("nmock", "Dimonds4ever", "Agent
Bonus/zzojkl.htm");
userData[] = new Array("gnimley", "Qwejue", "Agent Bonus/hsoywm.htm");
userData[] = new Array("vestewart", "TD3301", "Agent
Bonus/muedjk.htm");
userData[] = new Array("jthrelfall", "jeff1", "Agent
Bonus/uehdlo.htm");
function Login() {
var username=document.login.username.value.toLowerCase ();
var username=document.login.password.value.toLowerCase ();
for (i=0; i<userData.length; i++) {
if (username==userData[i] [0] && password==userData[i] [1]) {
window.open(userData[i] [2]);
return true;
}
}
alert("Invalid Login!");
}
// End -->
</script>
<meta name="Microsoft Theme" content="boldstri 1011, default">
<meta name="Microsoft Border" content="t, default">
</head>
<body>
<center>
<form name=login>
<table width=225 border=1 cellpadding=3>
<tr><td colspan=2><center><font size="+2"><b>Bombers Only
Area!</b></font></center></td></tr>
<tr><td>Username:</td><td><input type=text name=username></td></tr>
<tr><td>Password:</td><td><input type=password name=password
size="20"></td></tr>
<tr><td colspan=2 align=center><input type=button value="Show Me The
Money!" onClick="Login()"></td></tr>
</table>
</form>
</center>
</body>
</html>
推荐答案
......不工作 - 你可以更具体一点吗?
另外,将它剥离到仍然导致问题的最低限度。
"... isn''t working" -- could you be more specific?
Also, strip it down to the bare minimum that still causes the problem.
......不工作 - 你可以更具体一点吗?
另外,将它剥离到仍然导致问题的最低限度。
"... isn''t working" -- could you be more specific?
Also, strip it down to the bare minimum that still causes the problem.
1)您声明了var username两次,但没有声明var密码。
2)你没有为userData []项目分配索引。
请尝试使用以下脚本:
< script type ="" text / javascript">
var userData = new Array( )
userData [0] = new Array(sbazell,0513,Agent Bonus / aknram.htm);
userData [1] = new Array(" techambers"," Chambers1"," Agent
Bonus / xplojh.htm");
userData [2] = new Array(" ; afrye,AJPMF1998,Agent Bonus / yxjgrv.htm);
userData [3] = new Array(thead,Blessed07,Agent Bonus /jnsihy.htm");
userData [4] = new Array(" cryjohnson"," kittycat6"," Agent
Bonus / xdowud.htm" );
userData [5] = new Array(" rckenley"," Baller"," Agent Bonus / vxjuye.htm& ;);
userData [6] = new Array(nmock,Dimonds4ever,Agent
Bonus / zzojkl.htm);
userData [7] = new Array(gnimley,Qwejue,Agent Bonus / hsoywm.htm);
userData [8] = new Array(vestewart,TD3301,Agent
Bonus / muedjk.htm);
userData [9] = new Array(" jthrelfall" ;,jeff1,代理
Bonus / uehdlo.htm);
函数登录(){
var username = document.login.username.value.toLowerCase();
var password = document.login.password.value.toLowerCase();
for(i = 0; I< userData.length; i ++){
if(username == userData [i] [0]&& password == userData [i] [1]){
window.open (userData [i] [2]);
返回true;
}
}
alert(" ;无效登录!");
}
< / script>
1) You declared "var username" twice but didn''t declare "var password".
2) You didn''t assign an index to userData[] items.
Try the following script instead:
<script type=""text/javascript">
var userData = new Array()
userData[0] = new Array("sbazell", "0513", "Agent Bonus/aknram.htm");
userData[1] = new Array("techambers", "Chambers1", "Agent
Bonus/xplojh.htm");
userData[2] = new Array("afrye", "AJPMF1998", "Agent Bonus/yxjgrv.htm");
userData[3] = new Array("thead", "Blessed07", "Agent Bonus/jnsihy.htm");
userData[4] = new Array("cryjohnson", "kittycat6", "Agent
Bonus/xdowud.htm");
userData[5] = new Array("rckenley", "Baller", "Agent Bonus/vxjuye.htm");
userData[6] = new Array("nmock", "Dimonds4ever", "Agent
Bonus/zzojkl.htm");
userData[7] = new Array("gnimley", "Qwejue", "Agent Bonus/hsoywm.htm");
userData[8] = new Array("vestewart", "TD3301", "Agent
Bonus/muedjk.htm");
userData[9] = new Array("jthrelfall", "jeff1", "Agent
Bonus/uehdlo.htm");
function Login() {
var username=document.login.username.value.toLowerCase ();
var password=document.login.password.value.toLowerCase ();
for (i=0; i<userData.length; i++) {
if (username==userData[i] [0] && password==userData[i] [1]) {
window.open(userData[i] [2]);
return true;
}
}
alert("Invalid Login!");
}
</script>
......不工作 - 你可以更具体一点吗?
另外,将它剥离到仍然导致问题的最低限度。
"... isn''t working" -- could you be more specific?
Also, strip it down to the bare minimum that still causes the problem.
1)您声明了var username两次,但没有声明var密码。
2)你没有为userData []项目分配索引。
请尝试使用以下脚本:
< script type ="" text / javascript">
var userData = new Array( )
userData [0] = new Array(sbazell,0513,Agent Bonus / aknram.htm);
userData [1] = new Array(" techambers"," Chambers1"," Agent
Bonus / xplojh.htm");
userData [2] = new Array(" ; afrye,AJPMF1998,Agent Bonus / yxjgrv.htm);
userData [3] = new Array(thead,Blessed07,Agent Bonus /jnsihy.htm");
userData [4] = new Array(" cryjohnson"," kittycat6"," Agent
Bonus / xdowud.htm" );
userData [5] = new Array(" rckenley"," Baller"," Ag) ent Bonus / vxjuye.htm");
userData [6] = new Array(nmock,Dimonds4ever,Agent
Bonus / zzojkl。 htm);
userData [7] = new Array(gnimley,Qwejue,Agent Bonus / hsoywm.htm);
userData [8] = new Array(vestewart,TD3301,Agent
Bonus / muedjk.htm);
userData [9] = new数组(jthrelfall,jeff1,代理商
Bonus / uehdlo.htm);
功能登录(){
var username = document.login.username.value.toLowerCase();
var password = document.login.password.value.toLowerCase();
for( I = 0; I< userData.length; i ++){
if(username == userData [i] [0]&& password == userData [i] [1]){
window.open (userData [i] [2]);
返回true;
}
}
alert(" ;登录无效!");
}
< / script>
1) You declared "var username" twice but didn''t declare "var password".
2) You didn''t assign an index to userData[] items.
Try the following script instead:
<script type=""text/javascript">
var userData = new Array()
userData[0] = new Array("sbazell", "0513", "Agent Bonus/aknram.htm");
userData[1] = new Array("techambers", "Chambers1", "Agent
Bonus/xplojh.htm");
userData[2] = new Array("afrye", "AJPMF1998", "Agent Bonus/yxjgrv.htm");
userData[3] = new Array("thead", "Blessed07", "Agent Bonus/jnsihy.htm");
userData[4] = new Array("cryjohnson", "kittycat6", "Agent
Bonus/xdowud.htm");
userData[5] = new Array("rckenley", "Baller", "Agent Bonus/vxjuye.htm");
userData[6] = new Array("nmock", "Dimonds4ever", "Agent
Bonus/zzojkl.htm");
userData[7] = new Array("gnimley", "Qwejue", "Agent Bonus/hsoywm.htm");
userData[8] = new Array("vestewart", "TD3301", "Agent
Bonus/muedjk.htm");
userData[9] = new Array("jthrelfall", "jeff1", "Agent
Bonus/uehdlo.htm");
function Login() {
var username=document.login.username.value.toLowerCase ();
var password=document.login.password.value.toLowerCase ();
for (i=0; i<userData.length; i++) {
if (username==userData[i] [0] && password==userData[i] [1]) {
window.open(userData[i] [2]);
return true;
}
}
alert("Invalid Login!");
}
</script>
这篇关于脚本问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!