表单自动提交的问题,很急。请各位大人帮忙看看!!!!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>登录到TITLE>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
var current = "登录";
var help = "获得当前信息的帮助: " + current;
var headerMessage = "";
function statusBarMsg(message)
{
window.status = message;
}
function getCookie(name)
{
var cookieFound = false;
var start = 0;
var end = 0;
var cookieString = document.cookie;
var cookieValue;
var i = 0;
//scan the Cookie for the name
while (i <= cookieString.length)
{
start = i;
end = start + name.length;
if(cookieString.substring(start, end) == name)
{
cookieFound = true;
break;
}
i++;
}
//is name found/
if(cookieFound)
{
start = end+1;
end = document.cookie.indexOf(";",start);
if(end < start)
end = document.cookie.length;
cookieValue = document.cookie.substring(start, end);
start = 0;
end = cookieValue.indexOf(" ", start);
if(end < start)
end = cookieValue.length;
return cookieValue.substring(start, end);
}
return "";
}
function initFields()
{
document.logon.userid.value = getCookie("IMail_UserId");
document.logon.passwd.value = getCookie("IMail_password");
if(document.logon.passwd.value.length > 0)
{
document.logon.Use_Cookie.checked = 1;
}
}
function deleteCookie(name, path, domain)
{
if(getCookie(name))
{
document.cookie = name+ "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain: "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
function formSubmit()
{
deleteCookie("IMail_UserId", "/", null);
deleteCookie("IMail_password", "/", null);
deleteCookie("IMail_UserKey", "/", null);
}
// Begin cs_help.cgi
function openHelp(sHelp)
{
url = '/' + sHelp + '.html';
helpWin=window.open("",sHelp,"width=400,height=400,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
helpWin.document.write('<HTML><HEAD><TITLE>Online Help</TITLE></HEAD><FRAMESET BORDER=0 ROWS="24, *">');
helpWin.document.write('<FRAME MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no" NAME="toolbar" NORESIZE SRC="helptoolbar.html">');
helpWin.document.write('<FRAME MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="auto" NAME="mainPage" src="' + url + '">');
helpWin.document.write('<NOFRAMES>Sorry, you need to have a browser that supports frames to view this file.</NOFRAMES>');
helpWin.document.write('</FRAMESET></HTML>');
}
function doLogin()
{
if (confirm('您只要登陸就可以进入邮件系统。\n你要登陸嗎?'))
{
if (document.all!=null)
{
var ret="admin|888";//=showModalDialog("login.html",null,"center:yes;dialogWidth:1024px;dialogHeight:768px");
if (ret!=null)
{
var Arr=new Array();
Arr=ret.split("|")//***这里是取不出值的,因为ret为空
//alert(Arr[0]); //***我能夠打印出值
//alert(Arr[1]); //***我能夠打印出值
document.logon.userid.value = Arr[0];
document.logon.passwd.value = Arr[1];
document.logon.submit();
}
alert("ok");
document.logon.submit();
}
else
{
window.location.href="index1.asp"
}
}
}
doLogin();
</SCRIPT>
<STYLE TYPE="text/css">
<!--
body { color: black; background: #FFFFFF;}
b.special { font-style: normal; font-size: 10pt; font-weight: bold; font-family: Arial,Helvetica; color: #FF9900; text-decoration: none;}
-->
</STYLE>
</HEAD>
<BODY LINK="#003399" VLINK="#003399" ALINK="#0066CC" onLoad="statusBarMsg(current); document.logon.userid.focus(); initFields();">
<FORM NAME="logon" id="logon" METHOD="POST" ACTION="login.cgi">
<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="0" WIDTH="746">
<TR><TD BGCOLOR="#FFCC33" width="742">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="739" BGCOLOR="#FFCC33">
<TR>
<TD VALIGN="top" ROWSPAN="3" width="105">
<TABLE WIDTH="105" HEIGHT="75">
<TR>
<TD>
<CENTER>
<IMG SRC="imailc.gif" BORDER=0 ALIGN="left" width="96" height="75"></CENTER>
</TD>
</TR>
</TABLE>
</TD>
<INPUT TYPE="hidden" NAME="page" VALUE="login">
<TD WIDTH="15"> </TD>
<TD ALIGN="right" width="61">
<font size="2">用户名称</font><FONT SIZE="1" FACE="Arial, Helvetica">:</FONT>
</TD>
<TD WIDTH="255">
<INPUT TYPE="text" SIZE="32" NAME="userid">
</TD>
<TD WIDTH="31"> </TD>
<TD ALIGN="right" WIDTH="272">
<B CLASS="special"><font size="2">
<FONT COLOR="#FF9900" FACE="Arial,Helvetica">
IMail </FONT><FONT COLOR="#FF9900">邮件服务系统</FONT></font></B><FONT COLOR="#FF9900" SIZE="2" FACE="Arial,Helvetica"><B CLASS="special">,版本 </B>
</FONT>
</TD>
</TR>
<TR>
<TD width="15"> </TD>
<TD ALIGN="right" width="61">
<font size="2">登录密码</font><FONT SIZE="1" FACE="Arial, Helvetica">:</FONT>
</TD>
<TD width="255">
<INPUT TYPE="password" SIZE="32" NAME="passwd">
</TD>
<TD ALIGN="right" width="31"> </TD>
<TD width="272">
<INPUT TYPE="checkbox" NAME="Expire_Cache" VALUE="1">
<font size="2">
使用者超时重新登录</font><FONT FACE="Arial, Helvetica" SIZE="1">
</FONT>
</TD>
</TR>
<TR>
<TD width="15"> </TD>
<TD ALIGN="right" width="61"> </TD>
<TD ALIGN="right" width="255">
<INPUT TYPE="submit" VALUE="登录" onClick="return formSubmit(this.form);">
<INPUT TYPE="button" VALUE="帮助" onClick="openHelp('cs_login')" onMouseOver="statusBarMsg(help)" onMouseOut="statusBarMsg(current)">
</TD>
<TD ALIGN="right" width="31"> </TD>
<TD width="272">
<INPUT TYPE="checkbox" NAME="Use_Cookie" VALUE="1">
<font size="2">
记住使用者的名称和密码<FONT FACE="Arial, Helvetica"> <br>
(</FONT>公共场所或网吧<FONT FACE="Arial, Helvetica">,</FONT>不建议你这样<FONT FACE="Arial, Helvetica">)
</FONT>
</font>
<FONT FACE="Arial, Helvetica" SIZE="1">
</FONT></TD>
</TR>
</TABLE>
<!--IMAIL.WelcomeFileContents-->
</TD></TR>
</TABLE><BR>
</FORM>
</BODY>
</HTML>
这是我改了imail的web页,我想实现不用输入用户名和密码就直接进入。但出现这个错误:
document.logon.userid为空或不是对象,请各位大人看看为什么,如果有另外的好方法也请告诉我。
问题点数:0、回复次数:0Top




