JavaWeb這三週-FrameSet框架實現新聞後臺管理系統
阿新 • • 發佈:2019-01-31
實驗目的:利用frameset框架完成新聞後臺管理系統
使用技術型別:frameset、css、form表單提交。
1、新建登入頁面login.html:
簡單登入表單頁面,提交action為index.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="Style/Login.css" rel="stylesheet" type="text/css" />
<title>主頁</title>
</head>
<body>
<div id="wrapper">
<form id="form1" name="form1" action="index.html" >
<div class="login">
<div>
<label for="username">使用者名稱</label>
<input type="username" name="username" id="username" />
</div>
<div>
<label for="password">密 碼</label>
<input type="password" name="password" id="password" />
</div>
<div class="button" >
<input type="submit" name="Submit" value="登入" />
<input type="reset" name="Submit" value="重置" />
</div>
</div>
</form>
</div>
</body>
</html>
Login.css
/* CSS Document */
* {
margin: 0px;
padding: 0px;
}
body {
font-family: Arial, "宋體";
color: #FFFFFF;
font-size: 12px;
line-height: 24px;
}
a {
font-family: Arial, "宋體";
font-size: 12px;
color: #FFCC00;
text-decoration: underline;
margin-right: 5px;
}
a:hover {
text-decoration: none;
color: #FFFFFF;
}
#wrapper {
background-image: url(../Images/Bj_Login.jpg);
background-repeat: no-repeat;
background-position: 0px 0px;
height: 218px;
width: 670px;
margin-top: 150px;
margin-right: auto;
margin-left: auto;
}
.login {
height: 140px;
width: 222px;
float: right;
margin-top: 53px;
margin-right: 11px;
padding-top: 10px;
padding-left: 15px;
display: inline;
}
.login div {
margin-top: 15px;
margin-bottom: 15px;
height: 22px;
}
.login #type {
font-family: Arial, "宋體";
font-size: 12px;
}
.login #username {
border: 1px solid #0F509F;
width: 160px;
height: 16px;
}
.login #password {
border: 1px solid #0F509F;
width: 160px;
height: 16px;
}
.login .button {
padding-left: 55px;
}
.login .button input {
background-color: #FFA73D;
height: 20px;
width: 60px;
font-family: Arial, "宋體";
font-size: 12px;
font-weight: bold;
color: #FFFFFF;
background-image: url(../Images/Bj_loginButton.gif);
background-repeat: repeat-x;
background-position: 0px 0px;
border: 1px solid #DC6B00;
line-height: 18px;
}
#link {
text-align: center;
height: 16px;
}
2、新建主頁頂部頁面top.html:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="Style/Top.css" rel="stylesheet" type="text/css" />
<title>top</title>
</head>
<body>
<div id="top">
<div id="time">您好,今天是<span id="date">2015年9月10日 星期四</span></div>
<script type="text/javascript">
var d=new Date();
document.getElementById("date").innerHTML=d.getFullYear()+"年"+(d.getMonth()+1)+"月"+d.getDate()+"日"+" 星期"+"天一二三四五六 ".charAt(d.getDay());
</script>
</div>
<div id="menuBg">
<div id="name">管理員</div>
<div id="menu">
<a href="main.html" target="mainFrame" id="home">首頁</a></div>
</div>
</body>
</html>
Top.css
/* CSS Document */
body {
background-color: #FFFFFF;
background-repeat: repeat-x;
background-position: 999px top;
margin: 0px;
padding: 0px;
border: 0px;
background-image: url(../Images/Bj_top.gif);
}
#top {
background-color: #FFFFFF;
background-image: url(../Images/Pic_top_img.gif);
background-repeat: no-repeat;
background-position: left top;
width: 999px;
height: 76px;
font-family: Arial, Helvetica, sans-serif, "宋體";
font-size: 12px;
color: #000000;
}
#time {
line-height: 25px;
text-align: center;
height: 25px;
width: 235px;
font-family: Arial, Helvetica, sans-serif, "宋體";
padding: 0px;
margin-top: 0px;
margin-bottom: 0px;
margin-left: 702px;
margin-right: 0px;
}
#menuBg {
background-image: url(../Images/Bj_menu.gif);
background-repeat: repeat-x;
background-position: left top;
background-color: #0066CC;
height: 24px;
width: 100%;
margin: 0px;
padding: 0px;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
font-family: Arial, Helvetica, sans-serif, "宋體";
font-size: 12px;
color: #FFFFFF;
text-align: left;
line-height: 24px;
}
#name {
line-height: 24px;
height: 24px;
width: 70px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
background-image: url(../Images/Pic_iconAdmin.gif);
background-repeat: no-repeat;
background-position: left center;
font-weight: bold;
display: block;
float: left;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 20px;
margin-left: 10px;
border: 0px;
}
#menu {
margin: 0px;
padding: 0px;
float: right;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
}
#menu a {
margin-right: 16px;
font-family: Arial, "宋體";
font-size: 12px;
color: #FFFFFF;
text-decoration: none;
}
#menu #home {
background-image: url(../Images/Pic_homeIcon.gif);
background-repeat: no-repeat;
background-position: 0px 1px;
padding-left: 20px;
width: 30px;
height: 24px;
display: block;
float: left;
}
#menu #user {
background-image: url(../Images/Pic_iconUser.gif);
background-repeat: no-repeat;
background-position: 0px 1px;
padding-left: 22px;
width: 50px;
height: 24px;
display: block;
float: left;
}
#menu #manage {
background-image: url(../Images/Pic_iconManage.gif);
background-repeat: no-repeat;
background-position: 0px 1px;
padding-left: 22px;
width: 50px;
height: 24px;
display: block;
float: left;
}
#menu #quit {
background-image: url(../Images/Pic_quitIcon.gif);
background-repeat: no-repeat;
background-position: 0px 1px;
padding-left: 20px;
width: 30px;
height: 24px;
display: block;
float: left;
}
#menu #help {
background-image: url(../Images/Pic_helpIcon.gif);
background-repeat: no-repeat;
background-position: 0px 1px;
padding-left: 20px;
width: 30px;
height: 24px;
display: block;
float: left;
}
3、新建主頁左側頁面left.html:
包含導航連結,連結頁面至右側主頁面
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="Style/Left.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
//選單點選用方法--隱藏
function hideAll()
{
if (document.all.list.length==null)
{
list.style.display="none";
}
else
{
for(i=0;i<list.length;i++)
{
list[i].style.display="none";
}
}
}
//選單點選用方法--顯示
function showobj(num)
{
if (document.all.list.length==null)
{
if (list.style.display=="none")
{
hideAll();
list.style.display="inline";
}
else
{
list.style.display="none";
}
}
else
{
if (list[num].style.display=="none")
{
hideAll();
list[num].style.display="inline";
}
else
{
list[num].style.display="none";
}
}
}
</script>
<style type="text/css">
/*<![CDATA[*/
.yincang {
display:none;
}
/*]]>*/
</style>
<title>Left</title>
</head>
<body>
<div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="leftMenu">
<tr onclick="showobj(0)">
<td><a target="mainFrame">管理中心</a></td>
</tr>
<tr id="list" style="display:none;">
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="News/CategoryList.html" target="mainFrame">類別管理</a></td>
</tr>
<tr>
<td><a href="News/NewsList.html" target="mainFrame">新聞管理</a></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
Left.css
/* CSS Document */
body {
margin: 0px;
padding: 0px;
border: 0px;
background-image: url(../Images/Bj_left.gif);
background-repeat: repeat-y;
background-position: left top;
background-color: #3374BE;
}
.leftMenu {
width: 177px;
float: left;
border: 0px;
background-repeat: no-repeat;
background-position: 0px 0px;
background-image: url(../Images/Pic_left_line.gif);
padding: 0px;
margin-top: 14px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
}
.leftMenu td {
background-image: url(../Images/Pic_left_line.gif);
background-repeat: no-repeat;
background-position: left bottom;
padding-left: 10px;
line-height: 36px;
height: 30px;
cursor: hand;
}
.leftMenu a {
font-family: Arial, Helvetica, sans-serif, "宋體";
font-size: 14px;
font-weight: bold;
color: #12247A;
text-decoration: none;
line-height: 30px;
margin-left: 5px;
background-image: url(../Images/Pic_arrow.gif);
background-repeat: no-repeat;
background-position: 0px 10px;
display: block;
text-indent: 10px;
width: 100%;
}
.leftMenu a:hover {
background-image: url(../Images/Pic_arrow.gif);
background-repeat: no-repeat;
background-position: 0px 10px; /*padding-left: 14px;*/
}
.leftMenu td table {
border: 0px;
padding: 0px;
margin-left: 12px;
}
.leftMenu td table td {
background-image: url(../Images/Pic_left_line.gif);
background-repeat: no-repeat;
background-position: left bottom;
padding-left: 10px;
line-height: 36px;
height: 30px;
cursor: hand;
}
.leftMenu td table td a {
font-family: Arial, Helvetica, sans-serif, "宋體";
font-size: 12px;
font-weight: normal;
color: #12247A;
text-decoration: none;
line-height: 30px;
margin-left: 5px;
background-image: url(../Images/Pic_arrow.gif);
background-repeat: no-repeat;
background-position: 10px 10px;
display: block;
text-indent: 20px;
width: 100%;
}
.leftMenu td table td a:hover {
font-weight: bold;
background-image: url(../Images/Pic_arrow.gif);
background-repeat: no-repeat;
background-position: 24px 10px;
padding-left: 14px;
}
#shrink {
display: block;
height: 40px;
width: 5px;
padding: 0px;
margin-top: 156px;
margin-right: 0px;
margin-bottom: auto;
margin-left: 0px;
float: left;
}
4、新建分隔線頁面border.html:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
*{
margin:0px;
padding:0px;
border:0px;
}
body{
background-color:#3374BE;
}
#tab{
display:block;
height:100%;
width:5px;
padding:0px;
margin-top:126px;
margin-right:0px;
margin-bottom:0px;
margin-left:0px;
float:left;
}
</style>
<title>border</title>
</head>
<body>
<div id="tab"></div>
</body>
</html>
5、新建主頁右側主頁面:main.html:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="Style/Main.css" rel="stylesheet" type="text/css" />
<title>main</title>
</head>
<body>
<div id="main"></div>
</body>
</html>
main.css