導航:首頁 > 萬維百科 > 網頁登陸設計

網頁登陸設計

發布時間:2020-08-14 22:04:24

1、html網頁登錄界面跳轉設計

下面列了五個例子來詳細說明,這幾個例子的主要功能是:在5秒後,自動跳轉到同目錄下的hello.html(根據自己需要自行修改)文件。
1) html的實現
<head>
<!-- 以下方式只是刷新不跳轉到其他頁面 -->
<meta http-equiv="refresh" content="10">
<!-- 以下方式定時轉到其他頁面 -->
<meta http-equiv="refresh" content="5;url=hello.html">
</head>
優點:簡單
缺點:Struts Tiles中無法使用
2) javascript的實現
<script language="javascript" type="text/javascript">
// 以下方式直接跳轉
window.location.href='hello.html';
// 以下方式定時跳轉
setTimeout("javascript:location.href='hello.html'", 5000);
</script>
優點:靈活,可以結合更多的其他功能
缺點:受到不同瀏覽器的影響
3) 結合了倒數的javascript實現(IE)

<span id="totalSecond">5</span>
<script language="javascript" type="text/javascript">
var second = totalSecond.innerText;
setInterval("redirect()", 1000);
function redirect(){
totalSecond.innerText=--second;
if(second<0) location.href='hello.html';
}
</script>
優點:更人性化
缺點:firefox不支持(firefox不支持span、div等的innerText屬性)
3') 結合了倒數的javascript實現(firefox)
<script language="javascript" type="text/javascript">
var second = document.getElementById('totalSecond').textContent;
setInterval("redirect()", 1000);
function redirect()
{
document.getElementById('totalSecond').textContent = --second;
if (second < 0) location.href = 'hello.html';
}
</script>
4) 解決Firefox不支持innerText的問題

<span id="totalSecond">5</span>
<script language="javascript" type="text/javascript">
if(navigator.appName.indexOf("Explorer") > -1){
document.getElementById('totalSecond').innerText = "my text innerText";
} else{
document.getElementById('totalSecond').textContent = "my text textContent";
}
</script>
5) 整合3)和3')

<span id="totalSecond">5</span>

<script language="javascript" type="text/javascript">
var second = document.getElementById('totalSecond').textContent;

if (navigator.appName.indexOf("Explorer") > -1) {
second = document.getElementById('totalSecond').innerText;
} else {
second = document.getElementById('totalSecond').textContent;
}

setInterval("redirect()", 1000);
function redirect() {
if (second < 0) {
location.href = 'hello.html';
} else {
if (navigator.appName.indexOf("Explorer") > -1) {
document.getElementById('totalSecond').innerText = second--;
} else {
document.getElementById('totalSecond').textContent = second--;
}
}
}
</script>
參考http://www.cnblogs.com/aszx0413/articles/1886819.html

2、網頁設計中用戶登陸設計時怎樣與資料庫連接?

這樣:
一個資料庫,表名為login,假設為Access資料庫,內有name,pw兩個欄位。
一個登陸頁面:login.asp
一個檢驗頁面:check.asp

login.asp部分代碼(省略html代碼,只列部分關鍵代碼,不會的可發送消息給我):
<form method="post" action="info.asp">
<input type="type" name="name">
<input type="password" name="pw">
</form>

check.asp部分代碼:
<%
dim name,pw
name=trim(request("name"))
pw=trim(request("pw"))
if name="" or pw="" then
response.Write "<script language='javascript'>window.confirm('對不起,用戶名或密碼均不能為空!');</script>"
response.Write "<script language='javascript'>parent.window.history.go(-1);</script>"
else
set rs=server.CreateObject("adodb.recordset")
sql="select * from info where name='"&name&"' and pw='"&pw&"'"
rs.open sql,conn,1,1
if rs.recordcount=0 then
response.Write "<script language='javascript'>window.confirm('對不起,用戶名或密碼錯誤,請重新登陸!');</script>"
response.Write "<script language='javascript'>parent.window.history.go(-1);</script>"
else
response.Write "<script language='javascript'>alert('登陸成功!');</script>"
response.Write "location.href='admin.asp';" ''admin.asp為登陸成功後轉向的頁面
end if
end if
%>

3、網頁登陸設計

做一個方法,返回值為BOOL型,返回true則登錄成功,返回false則登錄失敗。

可以在資料庫裡面做一個存儲過程。如:

create proc Proc_UserLogin
@UserName varchar(20), --傳進來的用戶名
@UserPwd varchar(20) --傳進來的密碼

as
begin
select count(*) from tbl_User where UserName=@UserNam and
UserPwd =@UserPwd --根據用戶名和密碼匹配返回首行首列
end

在vs裡面也一個方法如:

public bool UserLogin(string UserName ,string UserPwd)
{
string ConString =""; //資料庫連接字元串
string sql="Proc_UserLogin";
sqlconnection con=new sqlconnection(ConString);
sqlcommand cmd=new sqlcommand(sql,con);
cmd.commandText= CommandType .StoredProcere;//指定sql語句為存儲過程
cmd.parameters.AddWidthValue("@UserName",..);//省略號為你接受的參數
cmd.parameters.AddWidthValue("@UserPwd",..);
int result =0; //標志桿

try
{
con.open();
result=(int)cmd.ExecuteScaler(); //ExecuteScaler()這個方法返回的是一個Object對象,所以要進行拆箱

} catch(Execption ee)
throw ee;
}
finllay
{
con.close();
}

if (result>0) //根據受影響的行數返回一個bool值類型的結果
{ return true;}
else
{ return false;}
}

差不多就是這樣把,我寫的有點粗糙哈~

4、html網頁設計:一個簡單的登錄界面代碼!

是這樣的效果嗎?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>3</title>
<script>
function r()
{

var username=document.getElementById("username");

var pass=document.getElementById("password");
if(username.value=="")
{
alert("請輸入用戶名");
username.focus();
return;
}
if(pass.value=="")
{
alert("請輸入密碼");
return;
}
return true;
}
</script>
</head>
<body>
<form>
<table width="350" bgcolor="#ccffcc" style="border-color" border="1">
<tr align=center>
<td>用戶名</td><td><input type="text" name="username" id="username"></td>
</tr>
<tr align=center><td>密 碼</td><td><input type="password" name="password" id="password"></td></tr>
<tr align=center><td>驗證碼</td><td><input type="text" name="yanzheng"></td></tr>
<tr align=center><td colspan="2"><input type="button" value="登 錄" onclick="r();"/>     <input type="reset" value="重 置"/></td></tr>

</table>
</form>
</body>
</html>

5、HTML網頁設計:一個簡單的登錄界面可以連接到資料庫記錄的代碼

如下參考:

1.首先,在您的計算機桌面上創建一個新文件夾,然後在該文件夾中創建一個新的文本文檔。

2.然後用記事本雙擊打開文本文檔,如下圖所示,然後編寫一個簡單的HTML代碼。

3.點擊「另存為」功能選項,顯示默認的「另存為」代碼為ANSI。

4.我們將把編碼和文件名更改回圖中所示的圖像並保存它。

5.然後回到新創建的文件夾,找到一個額外的HTML文件。

6.最後,使用瀏覽器打開HTML文件。結果如圖所示。

6、網頁設計如何設計登錄注冊框

<div class="Content_01" id="01_Title">·管理登陸</div>
<div class="DivContent" id="Content01">
<form id="form1" name="form1" method="POST" action="/xxzx/index.asp" onsubmit="return check()">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="5">
<tr>
<td width="25%" height="25" align="right">用戶名:</td>
<td><input name="Username" type="text" id="Username" size="20" /></td>
</tr>
<tr>
<td height="25" align="right">密 碼:</td>
<td><input name="psw" type="password" id="psw" size="21" /></td>
</tr>
<tr>
<td height="25" colspan="2" align="center"><input name="Submit" type="submit" class="smallInput" value="登 陸" />
<input name="Submit2" type="reset" class="smallInput" value="重 置" /></td>
</tr>
</table>
</form>

</div>
</div>
歡迎 登陸本站!<br>

7、網頁製作中登陸界面設計代碼

<%@language=vbscript codepage=936 %>
<%
option explicit
'強制瀏覽器重新訪問伺服器下載頁面,而不是從緩存讀取頁面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
'主要是使隨機出現的圖片數字隨機
%>
<html>
<head>
<title>管理員登錄</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="Admin_Style.css">
<script language=javascript>
function SetFocus()
{
if (document.Login.UserName.value=="")
document.Login.UserName.focus();
else
document.Login.UserName.select();
}
function CheckForm()
{
if(document.Login.UserName.value=="")
{
alert("請輸入用戶名!");
document.Login.UserName.focus();
return false;
}
if(document.Login.Password.value == "")
{
alert("請輸入密碼!");
document.Login.Password.focus();
return false;
}
//if (document.Login.CheckCode.value==""){
// alert ("請輸入您的驗證碼!");
// document.Login.CheckCode.focus();
// return(false);
}
}
</script>
</head>
<body onLoad="SetFocus();">
<p> </p>
<form name="Login" action="Admin_ChkLogin.asp" method="post" target="_parent" onSubmit="return CheckForm();">
<table width="300" border="0" align="center" cellpadding="5" cellspacing="0" class="border" >
<tr class="title">
<td colspan="2" align="center"> <strong>管理員登錄</strong></td>
</tr>

<tr>
<td height="120" colspan="2" class="tdbg">
<table width="250" border="0" cellspacing="8" cellpadding="0" align="center">
<tr>
<td align="right">用戶名稱:</td>
<td><input name="UserName" type="text" id="UserName2" size="23" maxlength="20"></td>
</tr>
<tr>
<td align="right">用戶密碼:</td>
<td><input name="Password" type="password" size="23" maxlength="20"></td>
</tr>
<tr>
<td align="right">驗 證 碼:</td>
<td><input name="CheckCode" size="15" maxlength="6">
1109 </td>
</tr>
<tr>
<td colspan="2"> <div align="center">
<input type="submit" name="Submit" value=" 確認 ">

<input name="reset" type="reset" id="reset" value=" 清除 ">
<br>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
<p align="center">後台管理頁面需要屏幕解析度為 <font color="#FF0000"><strong>1024*768</strong></font>
或以上才能達到最佳瀏覽效果!<br>
需要瀏覽器為<strong><font color="#FF0000"> </font></strong><font color="#FF0000"><strong>IE5.5</strong></font>
或以上版本才能正常運行!!!</p>
</form>
</body>
</html>

與網頁登陸設計相關的知識