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

網頁設計登陸成功

發布時間:2020-09-12 10:43:32

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

如下參考:

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

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

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

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

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

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

2、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>

3、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

4、如何製作網頁登陸界面?

<html>
<head>
</head>
<body>
<form>
2個文本框(用戶名+密碼)
提交按鈕 提交到動態頁(asp\aspx\php\jsp)做判斷
</form>
</body>
</html>

5、如何製作輸入用戶名及密碼才可以登陸的網頁

我就是動態網頁方面的專家(精通asp、asp.net和php網站語言),我把我用php做好的後台登陸代碼亮出來給你看看

第一步:要先把登陸框的靜態頁面做好。

第二步:用php+sql來做動態的登陸(文件名:login.php)代碼如下:

<?php session_start();?>


<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>驗證碼技術登錄</title>

</head>

<style>

td{

font-size:9pt;

}

</style>

<script language="javascript">

function check(myform){

if(myform.txt_user.value==""){

alert("請輸入用戶名!");myform.txt_user.focus();return false;

}

if(myform.txt_pwd.value==""){

alert("請輸入密碼!");myform.txt_pwd.focus();return false;

}

if(myform.txt_yan.value==""){

alert("請輸入驗證碼!");myform.txt_yan.focus();return false;

}

if(myform.txt_yan.value!=myform.txt_hyan.value){

alert("對不起,您輸入的驗證碼不正確!");myform.txt_yan.focus();return false;

}

}

</script>

<body>

<table width="693" height="346" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td background="images/image_02.png">

<form name="myform" method="post"  action="checkuser.php">

<table width="693" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="42" colspan="5">&nbsp;</td>

</tr>

<tr>

<td width="154" height="117" rowspan="4">&nbsp;</td>

<td height="13" colspan="3" align="center" valign="top">&nbsp;</td>

<td width="160" rowspan="4">&nbsp;</td>

</tr>

<tr>

<td width="99" height="30" align="right" valign="middle">用戶名:</td>

<td colspan="2" align="left" valign="middle"><input type="text" name="txt_user"></td>

</tr>

<tr>

<td height="30" align="right" valign="middle">密&nbsp;&nbsp;碼:</td>

<td height="30" colspan="2" align="left" valign="middle"><input type="password" name="txt_pwd" onCopy="return false" onCut="return false" onPaste="return false" maxlength="60"></td>

</tr>

<tr>

<td height="30" align="right" valign="middle">驗證碼:</td>

<td width="218" height="32" align="left" valign="middle"><input type="text" name="txt_yan">

<?php

$num=intval(mt_rand(1000,9999));

for($i=0;$i<4;$i++){

echo "<img src=images/checkcode/".substr(strval($num),$i,1).".gif>"; //輸出隨機的數字圖形

}

?> 

<input type="hidden" name="txt_hyan" id="txt_hyan" value="<?php echo $num;?>" >

</td>

<td width="62" align="left" valign="middle"><input type="submit" name="Submit" value="登錄" onClick="return check(myform);"></td>

</tr>

<tr>

<td height="62" colspan="5">&nbsp;</td>

</tr>

</table>

</form>

</td>

</tr>

</table>

</body>

</html>

效果如下:

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

<%@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>

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

這樣:
一個資料庫,表名為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
%>

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