用JS调用方法显示登陆信息(静态页面特别适用)
作者:cmscn 日期:2006-04-07
这个调用有两种方式,要横向显示时调用方法:
<script type="text/javascript" src="loginJS.asp?s=1"></script>
竖调用:
<script type="text/javascript" src="loginJS.asp"></script>
好处就是:
1、静态页面无法动态判断用户信息的时候用该方法。
2、放在页头等位置,又不想让搜索引擎首先搜索到这个。
代码内容(保存为loginJS.asp文件):
<!-- #include file="include/skin.asp" -->
<%
call web_head(0,0,6,0,0)
dim s
s=trim(Request("s"))
select case s
case "1"
call js_login_h()
case else
call js_login()
end select
call web_end(0,1)
sub js_login()
if login_mode="" then
%>
document.write("<table cellspacing=1 cellpadding=4 align=center>");
document.write("<tr><td align=center height=110>");
document.write("<table border=0>");
document.write("<form name=login_frm method=post action='<%=web_dim(6)%>login.asp?action=login_chk' onsubmit='return login_true()'>");
document.write("<input type=hidden name=chk value='yes'>");
document.write("<input type=hidden name=re_log value='yes'>");
document.write("<tr>");
document.write("<td>用户名:</td>");
document.write("<td><input type=text name=username value='' size=12 maxlegth=20></td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td>密码:</td>");
document.write("<td><input type=password name=password value='' size=12 maxlegth=20></td>");
document.write("</tr>");
document.write("<tr><td colspan=2 align=center><a href='<%=web_dim(6)%>register.asp'>新注册</a> <a href='<%=web_dim(6)%>user_getpass.asp' style='cursor:help;'>忘记密码</a> <input type=image src='<%=web_dim(6)%>images/index/user_login_button.gif' border=0 align=absmiddle onclick='jacascript:return login_true();'></td></tr>");
document.write("<tr><td colspan=2 align=center><a href='<%=web_dim(6)%>register.asp?action=resend' alt='重新发送一次我的注册验证邮件!'>发送注册邮件</a> <input type=checkbox id=id_memery_info name=memery_info value='yes' class=bg_td><label for=id_memery_info id=label_memery_info alt='如选择“记住密码”登陆,以后将自动登陆本站!'>记住密码</label></td></tr>");
document.write("</form>");
document.write("</table>");
document.write("</td></tr>");
document.write("</table>");
<%
else
%>
document.write("<table cellspacing=1 cellpadding=4 align=center>");
document.write("<tr><td align=center height=110>");
document.write("<table border=0>");
document.write("<tr><td align=center>您好,<font class=blue><b><%response.write login_username%></b></font></td></tr>");
document.write("<tr><td align=center>你现在已登陆 <font class=red2><%response.write login_mode%></font> 模式</td></tr>");
document.write("<tr><td align=center>您目前有<font class=red><%response.write login_emoney%></font><%response.write joekoe_cms.web_unit%>,<font class=red><%response.write login_integral%></font>分</td></tr>");
document.write("<tr><td align=center><a href='<%=web_dim(6)%>user_mail.asp'>我的短信箱(<%response.write login_msg%> 新)</a></td></tr>");
document.write("<tr><td align=center><a href='<%=web_dim(6)%>user_main.asp'>用户中心</a> <a href='<%=web_dim(6)%>login.asp?action=logout'>退出登陆</a></td></tr>");
document.write("</table>");
document.write("</td></tr>");
document.write("</table>");
<%
end if
end sub
sub js_login_h()
if login_mode="" then
%>
document.write("<table cellspacing=1 cellpadding=4 align=center>");
document.write("<form name=login_frm method=post action='<%=web_dim(6)%>login.asp?action=login_chk' onsubmit='return login_true()'>");
document.write("<input type=hidden name=chk value='yes'>");
document.write("<input type=hidden name=re_log value='yes'>");
document.write("<tr><td>用户名:</td>");
document.write("<td><input type=text name=username value='' size=12 maxlegth=20></td>");
document.write("<td>密码:</td>");
document.write("<td><input type=password name=password value='' size=12 maxlegth=20></td>");
document.write("<td><a href='<%=web_dim(6)%>register.asp'>新注册</a></td>");
document.write("<td><input type=checkbox id=id_memery_info name=memery_info value='yes' class=bg_td><label for=id_memery_info id=label_memery_info alt='如选择“记住密码”登陆,以后将自动登陆本站!'>记住密码</label></td></tr>");
document.write("</form>");
document.write("</table>");
<%
else
%>
document.write("<table cellspacing=1 cellpadding=4 align=center>");
document.write("<tr><td>您好,<font class=blue><b><%response.write login_username%></b></font></td>");
document.write("<td align=center><a href='<%=web_dim(6)%>user_mail.asp'>我的短信箱(<%response.write login_msg%> 新)</a></td>");
document.write("<td align=center><a href='<%=web_dim(6)%>user_main.asp'>用户中心</a> <a href='<%=web_dim(6)%>login.asp?action=logout'>退出登陆</a></td></tr>");
document.write("</table>");
<%
end if
end sub
%>
评论: 7 | 引用: 0 | 查看次数: 901
发表评论