首页 > 其他分享 >Lab02-2

Lab02-2

时间:2023-04-15 22:33:37浏览次数:39  
标签:cookies window Lab02 href jsp location toString

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>主页</title>
</head>
<style>
body
{
background-image: url(images/background.jpg);
background-size:100% 100% ;
background-attachment: fixed ;
}
table
{
border-spacing: 10px 20px;
border : solid 1px red;
margin-top:300px;
}
.font
{
letter-spacing:6px;
}
</style>
<script type="text/jscript">
request.setCharacterEncoding("utf-8");
function jump(adress,a)
{
if(adress=='s1')
{
if (a=="1")
window.location.href='login.jsp';
if (a=="2")
window.location.href='s1.jsp';
}
if(adress=='s2')
{
if (a=="1")
window.location.href='login.jsp';
if (a=="2")
window.location.href='s2.jsp';
}
if(adress=='s3')
{
if (a=="1")
window.location.href='login.jsp';
if (a=="2")
window.location.href='s3.jsp';
}
}
</script>
<body class = "font">
<%! String a="1";%>
<%! String b="亲爱的游客"; %>
<%
Cookie[] cookies = request.getCookies();
if(cookies != null && cookies.length > 0)
{
for(Cookie c: cookies)
{
if(c.getName().toString().equals("username"))
{
b = c.getValue().toString();
}
if(c.getName().toString().equals("id"))
{
a = c.getValue().toString();
}
}}

%>
<marquee scrollAmount="20" direction="left" scrollDelay="90" behavior="alternate" loop="-1" onm ouseover="this.stop()"
onm ouseout="this.start()" hspace="20%">
<a style="color: red; font-family: 黑体; font-size: 15pt; text-align: center;"><%=b %>,欢迎访问本网站</a>
</marquee>
<table align="center" valign="middle">
<tr> <td align="center"> <a href="s1.jsp">蜀道难</a></td></tr>
<tr> <td align="center"><a href="s2.jsp">将进酒</a></td></tr>
<tr> <td align="center"><a href="s3.jsp">行路难</a></td></tr>
<tr> <td align="center" > <a href="login.jsp">登录</a></td></tr>
</table>
</body>
</html>

标签:cookies,window,Lab02,href,jsp,location,toString
From: https://www.cnblogs.com/yingxq/p/17322112.html

相关文章

  • Lab02-3
    <%@pagelanguage="java"contentType="text/html;charset=UTF-8"pageEncoding="UTF-8"%><!DOCTYPEhtml><html><head><metacharset="UTF-8"><title>Inserttitlehere<......
  • CS61A_lab02
    1defcycle(f1,f2,f3):2"""Returnsafunctionthatisitselfahigher-orderfunction.34>>>defadd1(x):5...returnx+16......