会点JavaScript的都要进来, 关于Form提交的问题,

chentyoung 2004-09-21 11:36:44
我有个企业邮局.但每次在WEB登录时都要输入 用户@域名.com 全称,大家用不惯, 我现在想用JavaScript+ASP来完成,用户只要输入用户名和密码就可以了.后面的 "@域名.com"是取自IE地址栏.这个功能可以完成了.得出的是username@domain.com
但如何把输入的用户名+@+与取自IE地址栏的域名,在用户看不出的情况下发送到第二个Form 就是邮局真正的登录介面的框里啊?? 这个我就不会了.要在同一个页面啊.不能分成二个以上的,不然就没有意义了.
下面是我的email.asp代码:
<html>
<script language="javascript">
function GetHostName()
{//构造参数对象并初始化
var name,i;
var str=location.href;//获得浏览器地址栏URL串
var num=str.indexOf("://");
str=str.substr(num+3);//截取“://”后面的参数串
num=str.indexOf("/");
if(num>0)
{
name = str.substring(0,num);
}
else
{
name = str;
}
num = name.indexOf("mail.");
if(num >= 0)
{
name = name.substring(num + 5);
}
else
{
//name = "";
}
document.form2.domain.value = name;
return name;
}
</script>
<head>
<title>集团邮局</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"; charset="gb2312">
<link href="\css\cm25.css" rel="stylesheet" type="text/css">
<style>
body,td{font-size:9pt}

</STYLE>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" onload="GetHostName()">
<form name="form2" method="post" action="email.asp">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<table width="750" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="25"></td>
<td valign="top">用户名:</td>
<td valign="top">
<input name="user" type="text" class="input01" size="15">
</td>
<td valign="top"><font size="5">@ </font> </td>
<td valign="top">
<input name="domain" type="text" class="input01" size="15">
</td>
<td></td>
</tr>
</table>
<table width="750" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="25" width="223"></td>
<td width="78" valign="top">密码:</td>
<td width="170" valign="top">
<input type="password" NAME="passwd" size="22" class="input01">
</td>
<td width="279"></td>
</tr>
</table>
<table width="750" border="0" cellpadding="0" cellspacing="0">
<tr>
<input type=image src="/images/button_74.gif" name="enter" width="71" height="25" border="0" id="enter">
</tr>
</table>
</table>
</form>
<%
user=request("user")
E="@"
domain=request("domain")
passwd=request("passwd")
userid=user&e&domain '组装成username@domain.com字符串
%>
下面是进入邮局的登录介面
<html><body>
<FORM NAME="logon" METHOD="POST" ACTION="http://mail.6655.cn:8383/login.cgi">
<INPUT TYPE="hidden" NAME="page" VALUE="login">
<tbody>
<tr>
<TD ALIGN="right" width="96">用户名: </TD>
<TD WIDTH="226">
<INPUT class=textbox TYPE="text" SIZE="19" NAME="userid" value=<%response.write user%>>
</TD></tr>
<tr>
<TD ALIGN="right">密码:</TD>
<TD>
<INPUT class=textbox TYPE="password" maxlength=32 SIZE="19" NAME="passwd">
</TD></tr>

<TR>
<TD> </TD>
<TD>  <INPUT src="images/input.gif" type=image onClick="return formSubmit(this.form);">
</td></tr>
</FORM>

</body></html>
提供邮箱测试帐号test@6655.cn 密码:test
请大家多多帮忙.谢谢!!
...全文
232 15 打赏 收藏 举报
写回复
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
chentyoung 2004-10-22
  • 打赏
  • 举报
回复
哇.现在才弄好.看了这上面的贴子N遍,最后用 sandyuk(冰の沙隆) 太感谢这位兄弟了.哈哈
chentyoung 2004-09-24
  • 打赏
  • 举报
回复
都没人回啦.??? 可能是我太菜了.那我就要结贴子了.
chentyoung 2004-09-22
  • 打赏
  • 举报
回复
我还是做不成功啊.5555555555555555~~~~~~
chentyoung 2004-09-21
  • 打赏
  • 举报
回复
可不要以和我说的细点哪?//
zltostem 2004-09-21
  • 打赏
  • 举报
回复
为何两个form,提交的时候判断就可以了~~~
sandyuk 2004-09-21
  • 打赏
  • 举报
回复

一个FORM就够了
加一隐藏域
<INPUT class=textbox TYPE="hidden" SIZE="19" NAME="userid" >
表单提交时给userid 赋值,document.form2.userid.value = document.form2.user.value+'@'+domain;
chentyoung 2004-09-21
  • 打赏
  • 举报
回复
<INPUT class=textbox TYPE="text" SIZE="19" NAME="userid" value=<%response.write user%>>
这句写错了,值是这个的,value=<%response.write userid%>
chentyoung 2004-09-21
  • 打赏
  • 举报
回复
大哥,这个没地方调用数据库的
AVAmyZ 2004-09-21
  • 打赏
  • 举报
回复
x = userName
y = domainName


提交后,先整合成 z = x & "@" & y

再和数据库里面的数据进行判断不就ok?
whnnet 2004-09-21
  • 打赏
  • 举报
回复
@domain.com在提交的时候自动加上即可,不会连用户名也不愿意输入吧
bailou 2004-09-21
  • 打赏
  • 举报
回复
<form name=form1 method=post action="" onsubmit="return checkform()">
<input type=text name=userid value=''>
<input type=text name=usermm value=''>
</form>
<form name=form2 method=post action="bb.jsp">
<input type=hidden name=userid value=''>
<input type=hidden name=usermm value=''>
</form>
function checkform(){
form2.userid.value = form1.userid.value+"@"+domain_com;
form2.usermm.value = form1.usermm.value;
form2.submit();
return false;
}
bailou 2004-09-21
  • 打赏
  • 举报
回复
<form name=form1 method=post action="" onsubmit="return checkform()">
<input type=text name=userid value=''>
<input type=text name=usermm value=''>
</form>
<form name=form2 method=post action="bb.jsp" onsubmit="return checkform()">
<input type=hidden name=userid value=''>
<input type=hidden name=usermm value=''>
</form>
function checkform(){
form2.userid.value = form1.userid.value+"@"+domain_com;
form2.usermm.value = form1.usermm.value;
form2.submit();
return false;
}
wcqgm 2004-09-21
  • 打赏
  • 举报
回复
是的,在后台加入,当用户输入用户名是,让它输入不带@后缀的就可以了,你在<%加入@后缀字符,再到数据库中进行匹配%>
梅雪香 2004-09-21
  • 打赏
  • 举报
回复
用户名总是要有个验证的地方吧
而且如果是前台验证那就没必要验证
在后台验证的时候再加上@doamin.com不就行了
blestcc 2004-09-21
  • 打赏
  • 举报
回复
完全没有必要多写一个页面,在企业邮局的登录页面的基础上稍做改动就行了。
相关推荐
发帖
JavaScript

8.7w+

社区成员

Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
帖子事件
创建了帖子
2004-09-21 11:36
社区公告
暂无公告