国产午夜精品一区二区三区不-国产午夜精品一区二区三区不卡-国产午夜精品一区二区三区极品-国产午夜精品一区二区三区老-国产午夜精品一区二区三区漫-国产午夜精品一区二区三区嫩草

聊城網站制作公司,聊城網站建設,聊城網站優化,聊城網絡公司,聊城網站推廣,聊城網站運營,聊城網絡運營,聊城搜索引擎優化,聊城網頁設計,聊城網站制作
 
 
公司擁有五年的網站建設經驗,專業網站制作,推廣及網站優化,有大量優秀客戶案例
網站建設 | 設為首頁 | 加入收藏 | 聯系我們  
公告:熱烈慶祝聊城精英網絡2010版官方網站改版成功!
當前位置 :首頁 > 網頁知識  

ASP與數據庫,有用的代碼(轉貼,摘貼)

http://m.zjgjyh.cn   2010-12-23   人氣:

ASP與數據庫
ASP與數據庫運用:密碼驗證
        Microsoft 的大作ASP(Active Server
      Pages)以其易學易用、擴充性好、功能多而強等優點正掀起一場新的web編程革命(從嚴格意義上講,編寫asp并不是編程),它以令人吃驚的發展和普及速度大有取代由perl等語言編寫的CGI(Common
      Gateway Interface,通用網關接口) 的勢頭。基于web
      page方式的web管理模式已經成為潮流,看看現在的網管們,有誰不會asp的編寫呢?要管理?那你可能就要用到我這里要說的“密碼驗證”了。簡單地說,密碼驗證就是首先判斷你是不是有登錄權限,如果有,就繼續,否則,哼哼……。什么?你到現在還不知道ASP是什么東東?“該程序執行了非法操作,即將被關閉。如仍有問題,請與程序供應商聯系。”----------系統語
        下面,我們就來看看實現密碼驗證的ASP需要些什么吧。
        一、 ASP運行環境:
        Windows 95/98單機平臺:PWS (Personal Web Server)4.0 、windows NT
      4.0/5.0服務器平臺:IIS(Internet Information Server )Service Pack 3 及其以上版本)
        NT workstation 4.0 工作站平臺:PWS(Personal Web Server )NT
      workstation版及最新版的IE瀏覽器。
        二、 用于制作ASP的軟件
        Windows FrontPage 98/2000 、Dreamweaver 3.0 ,如果這些軟件你都沒有,那你就用windows
      中的Notepad
      當一次“代碼編寫狂”吧。不過ASP中很多代碼仍是需要我們手工編寫大量代碼的,用專用的網頁制作軟件只不過是偷一丁點懶而已。
        三、 用哪一種數據庫作為儲存用戶資料(用戶名及密碼)的數據庫呢?
        SQL Server、Microsoft Access
      97/2000等都可以。本人建議你使用Access,因為你可能對它比較熟悉,一旦有問題,解決起來比較容易,更深的原因是:Microsoft
      Access相對于其它非服務器等級的數據庫執行的效率要高得多。
        好了,廢話說了這么多,可能你早已經不耐煩了。不過,這對于一些ASP的初學者可能還是有幫助的,對于這部分讀者,你們可能還得要看看關于ASP方面的書籍或網站來增加你對ASP基本語法的了解。
        讓我們一步一步來做這個密碼驗證吧,我采用的是Windows 98 + PWS 4.0平臺,IE
      5.0瀏覽器,網頁制作軟件:FrontPage 2000. Go!
        一、創建用戶密碼數據庫
        先用Access建立一個用戶密碼數據庫,建立字段名id和psd,并添加值.如:id的值我設為:admin,psd的值為:www,當然,你還可以繼續添加用戶id及psd,完成后保存為:psd.mdb。
        二、編寫psd.asp(用戶登錄界面頁,完成驗證的功臣就是它了)及log.asp(成功登錄后顯示的頁面)。在編寫之前,我們來分析一下常見的用戶登錄界面,比如說你想收取基于web
      page方式免費郵件箱的登錄界面:管理用戶登錄的文件名常常為log.*,開始登錄時是這個文件,登錄完成后瀏覽器的地址欄中還是顯示的這個文件名,這是怎么回事兒呢?用ASP的方法來講,原來,用戶登錄的文件被包含在登錄完成后的文件中。以我現在要講的這個例子來說,psd.asp就是被包含在log.asp中了。用戶登錄時看到的文件名將是:log.asp,而log.asp要求系統先執行psd.asp,通過驗證之后才看到真正的log.asp網頁。對了!實際上密碼驗證的關鍵在psd.asp。在你讀完本文后,你會深深體會這一點。既然psd.asp文件是關鍵,那我們就先來看看psd.asp是怎么寫的。
        運行FrontPage新建一個文件,并保存為:psd.asp(在FrontPage 的保存類型中選取“Active Server
      Pages”)。在FrontPage
      左下角選取“HTML”先在它的頂部進行ASP源代碼的編寫,內容如下(以下源代碼中凡出現“‘……”的均為注釋):
        <%
        function checkPwd(id,psd) '檢測用戶id及密碼
        dim conn,param,rs
        set conn=server.createobject("adodb.connection") '創建數據庫連接對象conn
        param="driver={microsoft access driver (*.mdb)}"
      ‘指定數據庫驅動程序,不可省略寫為“access diver(*.mdb)”
        conn.open param & ";dbq=" & server.mappath("psd.mdb")
      '用指定的數據庫驅動程序打開數據庫,并指定數據路徑
        sql="select*from psd where id='" & id & "' and psd='" & psd & "'"
      ‘定義sql從數據庫中讀取id及psd的值,本行中的第一個psd是指數據庫名,以后的psd是指psd.mdb中的psd字段。
        set rs=conn.execute(sql) '打開數據庫
        if rs.eof then
        checkpwd=false
        else
        checkpwd=true
        end if
        end function
      ‘以上幾句判斷是否已經讀完數據庫中的記錄,如果沒有,就向后讀,如果已經完成,則驗證用戶名及密碼。如果驗證通過,則為true,反之為flase
        %>
        <%
        if isEmpty(session("passed")) then session("passed")=false
      '判斷用戶輸入信息
        id=request("id") ‘獲取用戶id(用戶名)
        psd=request("psd") ‘獲取用戶psd(密碼)
        if id="" or psd="" then
        response.write"請輸入您的登錄名及密碼。" '如果用戶沒有輸入完整的信息,返回出錯信息。
        elseif not checkpwd(id,psd) then
        response.write"用戶名或密碼錯誤!<br>請檢查你的用戶名及密碼然后再試一次!"
      ‘如果用戶已經輸入完整信息,但輸入錯誤也返回出錯信息。
        else session("passed")=true
        end if
        if not session("passed") then%>
      ‘用戶輸入的信息完全正確并驗證通過,以下開始編寫html代碼,做一個用戶登錄界面。
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html;
      charset=gb2312">
        <title>請您輸入您的用戶名及密碼!</title>
        </head>
        <body bgcolor="#000000" text="#FFFFFF">
        <p align="center"> 
        <p align="center"> </p>
        <p align="center"><b><font face="黑體"
      size="6">用戶登錄首頁</font></b></p>
        <p align="center"> </p>
        <form method="POST"
      action="<%=request.serverVariables("psd.mdb")%>">
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tr>
        <td width="41%" align="right">用戶名:</td>
        <td width="59%"><input type="text" name="id" size="20"
      value="<%=id%>"></td>
        </tr>
        <tr>
        <td width="41%" align="right"> 密 碼:</td>
        <td width="59%"><input type="password" name="psd" size="20"
      value="<%=psd%>"></td>
        </tr>
        <tr>
        <td width="41%"> </td>
        <td width="59%"> </td>
        </tr>
        </table>
        <p align="center"><input type="submit" value="提交" name="B1"><input
      type="reset" value="清除" name="B1"></p>
        </form>
        <%response.end
        end if %> ‘驗證過程結束,進入加密網頁。
        </body>
        </html>
        完成了psd.asp的編寫,可能你早已經迫不及待地想知道log.asp怎么編寫了吧。讓我們繼續吧!
        Log.asp的內容:
        <!--#include file="psd.asp"-->
      ‘在log.asp源代碼中的頂部輸入這句,作用就是在系統執行log.asp之前先執行psd.asp啦!
        <html>
        <head>
        <title>用戶驗證通過,您已經成功登錄系統</title>
        </head>
        <body><center><p><p><p><p>用戶驗證通過,您已經成功登錄!<br>
        現在你可以進行你想要的操作了。如果你有什么問題,請來信Email<a
      href="mailto:kanwo@163.net?subject=問你幾個關于密碼驗證的問題">kanwo@163.net</a></center>
        </body>
        </html>
        呵呵……手寫了這么多,還受得了吧。你在編寫完成之后,可以移植到其它平臺上,比如Windows
      NT。最后,將你做的這兩個asp文件及psd.mdb數據庫放在同一個目錄下(該目錄必須在PWS或IIS中有www服務),比如:c:\inetpub\wwwroot\。然后,在確保你的PWS或IIS在運行的情況下,在你們IE瀏覽器的地址欄中輸入http://127.0.0.1/log.asp,看看,會有什么!(如果你在登錄過程中聽到你的硬盤在響,可別嚇著了喲!)


q 文 章 點 評 3 篇

>>上篇文章:ASP技術訪問WEB數據庫
>>下篇文章:制作有管理功能的ASP留言板


第三招:控制你的彈出窗口只彈出一次(如果每進一次,刷新一次就彈出你不覺得很煩和麻煩嗎?)有什么好的辦法嗎?
那是當然的啊,我們現在只要使用cookie來控制就能實現這樣的要求了。
首先,你需把將如下代碼加入到頁面HTML的<HEAD>和</HEAD>之間:
<script>
.function openwin(){
.window.open("pop1.html","","width=120,height=240")
.}
.function get_cookie(Name) {
.var search = Name + "="
.var returnvalue = "";
.if (document.cookie.length > 0) {
.offset = document.cookie.indexOf(search)
.if (offset != -1) {
.offset += search.length
.end = document.cookie.indexOf(";", offset);
.if (end == -1)
.end = document.cookie.length;
.returnvalue=unescape(document.cookie.substring(offset, end))
. }
. }
.return returnvalue;
. }
.function loadpopup(){ //*控制彈出窗口的函數喲,你要使用他的啊
.if (get_cookie('popped')==''){
.openwin()
.document.cookie="popped=yes"
. }
.}
.//-->
</script>
 然后,用<body onload="loadpopup()">替換頁面中原來的<BODY>這一句就行的了。

》》》》》》》》》》》》》》》》》》》》》》----------------------------------
在提交帖之后:
<%
if Response.Cookies("time")<>"" then
if DateDiff('s',Response.Cookies("time"),now())<20 '隔20s才能再發帖
Response.Write "<script>alert('不能頻繁發帖');window.location=history.go(-1)</script>"
response.End
end if
end if
Response.Cookies("time")=now()
…… '將帖子入庫
----------------------------------------------------------
ASP項目中的公共翻頁模塊:
在大型的ASP項目中,很多的頁面都涉及到翻頁功能。如果每個頁面都寫一個翻頁的程序的話,這樣的工作即降低了工作效率,也不利于工程的模塊化,不能使代碼重用。因此,把翻頁這樣的功能模塊化是很有必要的。
設計方法:
1、調用該模塊時,只需要傳遞記錄集和每頁顯示的記錄的條數;
2、可以點擊鏈接進行翻頁,也可以直接輸入頁碼,回車后翻頁;
3、不要考慮文件名,程序的每次翻頁都能在當前頁面。
想清楚了上面3個問題,我們的公共翻頁模塊就可以動手了。
<%
'+++++++++++++++++++++++++++++++++++++
'◆模塊名稱: 公共翻頁模塊
'◆文 件 名: TurnPage.asp
'◆傳入參數: Rs_tmp (記錄集), PageSize (每頁顯示的記錄條數)
'◆輸 出: 記錄集翻頁顯示功能
'+++++++++++++++++++++++++++++++++++++
'
Sub TurnPage(ByRef Rs_tmp,PageSize) 'Rs_tmp 記錄集 PageSize 每頁顯示的記錄條數;
Dim TotalPage '總頁數
Dim PageNo '當前顯示的是第幾頁
Dim RecordCount '總記錄條數
Rs_tmp.PageSize = PageSize
RecordCount = Rs_tmp.RecordCount
TotalPage = INT(RecordCount / PageSize * -1)*-1
PageNo = Request.QueryString ("PageNo")
'直接輸入頁數跳轉;
If Request.Form("PageNo")<>"" Then PageNo = Request.Form("PageNo")
'如果沒有選擇第幾頁,則默認顯示第一頁;
If PageNo = "" then PageNo = 1
If RecordCount <> 0 then
Rs_tmp.AbsolutePage = PageNo
End If
'獲取當前文件名,使得每次翻頁都在當前頁面進行;
Dim fileName,postion
fileName = Request.ServerVariables("script_name")
postion = InstrRev(fileName,"/")+1
'取得當前的文件名稱,使翻頁的鏈接指向當前文件;
fileName = Mid(fileName,postion)
%>
<table border=0 width='100%'>
<tr>
<td align=left> 總頁數:<font color=#ff3333><%=TotalPage%></font>頁
當前第<font color=#ff3333><%=PageNo%></font>頁</td>
<td align="right">
<%If RecordCount = 0 or TotalPage = 1 Then
Response.Write "首頁|前頁|后頁|末頁"
Else%>
<a href="<%=fileName%>?PageNo=1">首頁|</a>
<%If PageNo - 1 = 0 Then
Response.Write "前頁|"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo-1%>">前頁|</a>
<%End If
If PageNo+1 > TotalPage Then
Response.Write "后頁|"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo+1%>">后頁|</a>
<%End If%>
<a href="<%=fileName%>?PageNo=<%=TotalPage%>">末頁</a>
<%End If%></td>
<td width=95>轉到第
<%If TotalPage = 1 Then%>
<input type=text name=PageNo size=3 readonly disabled style="background:#d3d3d3">
<%Else%>
<input type=text name=PageNo size=3 value="" title=請輸入頁號,然后回車>
<%End If%>頁
</td>
</tr>
</table>
<%End Sub%>
當然,大家可以把翻頁的鏈接做成圖片按鈕,這樣的話也面就更加美觀了。
調用方法:
1、在程序開始或要使用翻頁的地方包含翻頁模塊文件;
2、定義變量:RowCount,每頁顯示的記錄條數
3、調用翻頁過程:Call TurnPage(記錄集,RowCount)
4、在Do While 循環輸出記錄集的條件中加上" RowCount > 0 " 條件
5、在循環結束 "Loop前" 加上: RowCount = RowCount - 1
'-----------------------------------------------------
調用范例:
文件名:News.asp
<%
Dim Conn,Rs_News
Set Conn = server.CreateObject("ADODB.CONNECTION")
Conn.Open "cpm","cpm","cpm"
Dim Sql
Sql = "Select * from News"
Set Rs_News = Server.CreateObject("ADODB.RECORDSET")
Rs_News.Open Sql,Conn,1,3 '獲取的記錄集
'公共翻頁模塊開始%>
<!--#include file=../Public/TurnPage.asp-->
<%
Dim RowCount
RowCount = 10 '每頁顯示的記錄條數
Call TurnPage(Rs_News,RowCount)
'公共翻頁模塊結束%>
<table width=100%>
<tr>
<td>新聞編號</td>
<td>新聞標題</td>
<td>發布日期</td>
<tr>
<%
If Not Rs_News.eof
Do while Not Rs_News.eof and RowCount>0
%>
<tr>
<td><%=Rs_News("ID")%></td>
<td><%=Rs_News("Name")%></td>
<td><%=Rs_News("Date")%></td>
<tr>
<%
RowCount = RowCount - 1
Rs_News.MoveNext
Loop
End If
%>
(出處:www.dev-club.com)

--------------------------------------------------------------------
在提交帖之后:
<%
if Response.Cookies("time")<>"" then
if DateDiff('s',Response.Cookies("time"),now())<20 '隔20s才能再發帖
Response.Write "<script>alert('不能頻繁發帖');window.location=history.go(-1)</script>"
response.End
end if
end if
Response.Cookies("time")=now()
…… '將帖子入庫

---------------------------------
怎樣去除執行window.close()后彈出的‘是否關閉窗口'對話框
self.opener=null;
self.close();
但是只能在IE5.5 或IE6.0上用
最小化、最大化、關閉窗口
<object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Minimize"></object>
<object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Maximize"></object>
<OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM NAME="Command" value="Close"></OBJECT>
-------------------------------------------------------
我的下拉框中又兩個選項,當選擇第一個時,出現一個用戶輸入頁面,但是有一部分input框是不要用戶填寫的。當選擇第二項時,出現地頁面是全部都要填寫的。不知道該如何實現?
<select onchange="text1.disabled=this.selectedIndex==0">
<option>False</option>
<option>True</option>
</select>
<input type=text id=text1 disabled>
------------------------------------------------------------------>>>>>>>>>>>>>>
我的目的是:打開一個web頁(就稱為'原頁' 吧),點擊一個按鈕彈出一個小窗口(原頁不關,小窗口最好可以拖動),在小窗口里提交一個表單到原頁。有什么方法可以實現?
給『原頁』一個name屬性,表單的target指向它
<script>
this.name = "bencalie";
newwin = window.open("","","width=400,height=200");
newwin.document.write("<form action='test.cgi' target='bencalie'><input type=submit></form>");
</script>
<<<<<<<<<<<<<<<<<<<<<<<==============================================
沒有邊框的窗口::;;;;
<HTML XMLNS:IE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<IE:Download ID="include" STYLE="behavior:url(#default#download)" />
<title>Chromeless Window</title>
<SCRIPT LANGUAGE="JScript">
/*--- Special Thanks For andot ---*/
/*
This following code are designed and writen by Windy_sk <seasonx@163.net>
You can use it freely, but u must held all the copyright items!
*/
/*--- Thanks For andot Again ---*/
var CW_width = 400;
var CW_height = 300;
var CW_top = 100;
var CW_left = 100;
var CW_url = "http://www.cnbruce.com/bluebook/";
var New_CW = window.createPopup();
var CW_Body = New_CW.document.body;
var content = "";
var CSStext = "margin:1px;color:black; border:2px outset;border-style:expression(onmouseout=onmouseup=function(){this.style.borderStyle='outset'}, onmousedown=function(){if(event.button!=2)this.style.borderStyle='inset'});background-color:buttonface;width:16px;height:14px;font-size:12px;line-height:11px;cursor:Default;";
//Build Window
include.startDownload(CW_url, function(source){content=source});
function insert_content(){
var temp = "";
CW_Body.style.overflow = "hidden";
CW_Body.style.backgroundColor = "white";
CW_Body.style.border = "solid black 1px";
content = content.replace(/<a ([^>]*)>/g,"<a onclick='parent.open(this.href);return false' $1>");
temp += "<table width=100% height=100% cellpadding=0 cellspacing=0 border=0>";
temp += "<tr style=';font-size:12px;background:#0099CC;height:20;cursor:default' ondblclick=\"Max.innerText=Max.innerText=='1'?'2':'1';parent.if_max=!parent.if_max;parent.show_CW();\" onmouseup='parent.drag_up(event)' onmousemove='parent.drag_move(event)' onmousedown='parent.drag_down(event)' onselectstart='return false' oncontextmenu='return false'>";
temp += "<td style='color:#ffffff;padding-left:5px'>Chromeless Window For IE6 SP1</td>";
temp += "<td style='color:#ffffff;padding-right:5px;' align=right>";
temp += "<span id=Help onclick=\"alert('Chromeless Window For IE6 SP1 - Ver 1.0\\n\\nCode By Windy_sk\\n\\nSpecial Thanks For andot')\" style=\""+CSStext+"font-family:System;padding-right:2px;\">?</span>";
temp += "<span id=Min onclick='parent.New_CW.hide();parent.blur()' style=\""+CSStext+"font-family:Webdings;\" title='Minimum'>0</span>";
temp += "<span id=Max onclick=\"this.innerText=this.innerText=='1'?'2':'1';parent.if_max=!parent.if_max;parent.show_CW();\" style=\""+CSStext+"font-family:Webdings;\" title='Maximum'>1</span>";
temp += "<span id=Close onclick='parent.opener=null;parent.close()' style=\""+CSStext+"font-family:System;padding-right:2px;\" title='Close'>x</span>";
temp += "</td></tr><tr><td colspan=2>";
temp += "<div id=include style='overflow:scroll;overflow-x:hidden;overflow-y:auto; HEIGHT: 100%; width:"+CW_width+"'>";
temp += content;
temp += "</div>";
temp += "</td></tr></table>";
CW_Body.innerHTML = temp;
}
setTimeout("insert_content()",1000);
var if_max = true;
function show_CW(){
window.moveTo(10000, 10000);
if(if_max){
New_CW.show(CW_top, CW_left, CW_width, CW_height);
if(typeof(New_CW.document.all.include)!="undefined"){
New_CW.document.all.include.style.width = CW_width;
New_CW.document.all.Max.innerText = "1";
}
}else{
New_CW.show(0, 0, screen.width, screen.height);
New_CW.document.all.include.style.width = screen.width;
}
}
window.onfocus = show_CW;
window.onresize = show_CW;
// Move Window
var drag_x,drag_y,draging=false
function drag_move(e){
if (draging){
New_CW.show(e.screenX-drag_x, e.screenY-drag_y, CW_width, CW_height);
return false;
}
}
function drag_down(e){
if(e.button==2)return;
if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height)return;
drag_x=e.clientX;
drag_y=e.clientY;
draging=true;
e.srcElement.setCapture();
}
function drag_up(e){
draging=false;
e.srcElement.releaseCapture();
if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height) return;
CW_top = e.screenX-drag_x;
CW_left = e.screenY-drag_y;
}
</SCRIPT>
</HTML>
============================================================>>>>>>>>>>>>>>>>>>>>>

還有圖片的“黑白轉彩色”
<SCRIPT>
function doTrans(filterCode)
{
imgObj.filters[0].apply();
oImg.style.filter = filterCode
imgObj.filters[0].play();
}
</SCRIPT>
<SPAN id=imgObj
onmouseleave='doTrans("gray")'
style="FILTER: progid:DXImageTransform.Microsoft.Fade(Overlap=1.00); WIDTH: 1px"
onmouseenter='doTrans("")'>
<IMG id=oImg style="FILTER: gray" src="http://www.cnbruce.com/images/cnrose/a.gif">
</SPAN>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
模擬office菜單:::
:::::::::::::
<style type="text/css">
* { font-size: 12px; }
body { margin: 0px; }
</style>
<script language="JavaScript">
// Office XP 菜單
var sub_display = false;
// 顏色數組說明:此數組儲存菜單各部份顏色樣式,可以改變顏色值達到改變樣式的效果
// 值依次為:高亮背景色, 高亮邊框色, 菜單欄背景色, 子菜單背景色, 子菜單邊框色, 子菜單標題色, 子菜單陰影色
var color = ['#B6BDD2', '#0A246A', '#D4D0C8', '#F8F8F8', '#666666', '#DBD8D1', '#DDDDDD'];
// 菜單數組說明:此數組儲存各菜單數據
// 值依次為:
// 1. 主菜單名稱, 下拉菜單右延空白長度
// 2. 第1個子菜單名稱, 鏈接地址
// 3. 第2個子菜單名稱, 鏈接地址
// 4. ......
var menu = new Array();
menu[0] = [['菜單一', 50], ['1111', '1.htm'], ['2222', '2.htm'], ['3333', '3.htm']];
menu[1] = [['菜單二', 50], ['1111', '1.htm'], ['2222', '2.htm'], ['3333', '3.htm']];
menu[2] = [['菜單三', 50], ['1111', '1.htm'], ['2222', '2.htm'], ['3333', '3.htm']];
menu[3] = [['菜單四', 50], ['1111', '1.htm'], ['2222', '2.htm'], ['3333', '3.htm']];
menu[4] = [['菜單五', 50], ['1111', '1.htm'], ['2222', '2.htm'], ['3333', '3.htm']];
menu[5] = [['菜單六', 50], ['1111', '1.htm'], ['2222', '2.htm'], ['3333', '3.htm']];

document.write('<table width="100%" cellspacing="0" cellpadding="0" style="background-color: ' + color[2] + '; border-left: 1px #F4F4F4 solid; border-top: 1px #F4F4F4 solid; border-right: 1px #999999 solid; border-bottom: 1px #999999 solid;" onSelectStart="return false;" onContextMenu="return false;"><tr><td width="5"><img width="5" height="1"></td><td><table cellspacing="0" cellpadding="2"><tr>');
for (var i=0; i<menu.length; i++)
document.write('<td style="border: 1px ' + color[2] + ' solid; cursor: default;" onClick="Menu_Click(this, ' + i + ')" onMouseOver="Menu_Over(this, ' + i + ')" onMouseOut="Menu_Out(this, ' + i + ')"><nobr><img width="10" height="1">' + menu[i][0][0] + '<img width="10" height="1"></nobr></td>');
document.write('</td></tr></table></tr></table>');
for (var i=0; i<menu.length; i++) {
document.write('<table id="subMenu" cellspacing="0" cellpadding="0" onSelectStart="return false;" onContextMenu="return false;" style="position: absolute; display: none; top: 1px; border-left: 1px ' + color[4] + ' solid; border-bottom: 1px ' + color[4] + ' solid; cursor: default; filter:progid:dximagetransform.microsoft.dropshadow(color=' + color[6] + ',offx=3,offy=3,positive=true)"><tr><td style="border-top: 1px ' + color[4] + ' solid; border-right: 1px ' + color[4] + ' solid; background-color: ' + color[5] + ';" onClick="subMenu_Hide(false)"><nobr><img width="1" height="2"><br><img width="12" height="1">' + menu[i][0][0] + '<img width="12" height="1"><br><img width="1" height="3"></nobr></td><td style="border-bottom: 1px ' + color[4] + ' solid;" onMouseOver="subMenu_Hide(true)"><img width="' + menu[i][0][1] + '" height="1"></td></tr><tr><td colspan="2" style="border-right: 1px ' + color[4] + ' solid; background-color: ' + color[3] + ';"><table width="100%" cellspacing="1" cellpadding="2" style=" background-color: ' + color[3] + '">');
for (var j=1; j<menu[i].length; j++)
document.write('<tr><td style="border: 1px ' + color[3] + ' solid;" onMouseOver="subMenu_Over(this)" onMouseOut="subMenu_Out(this)" onClick="location.href=\'' + menu[i][j][1] + '\'"><nobr> ' + menu[i][j][0] + '</nobr></td></tr>');
document.write('</td></tr></table></td></tr></table>');
}
function Menu_Over(obj, s) {
if (sub_display) {
subMenu_Show(obj, s)
}
else {
obj.style.backgroundColor = color[0];
obj.style.border = '1px ' + color[1] + ' solid';
}
}
function Menu_Out(obj) {
obj.style.backgroundColor = '';
obj.style.border = '1px ' + color[2] + ' solid';
}
function Menu_Click(obj, s) {
subMenu_Show(obj, s)
}
function subMenu_Over(obj) {
obj.style.backgroundColor = color[0];
obj.style.border = '1px ' + color[1] + ' solid';
}
function subMenu_Out(obj) {
obj.style.backgroundColor = '';
obj.style.border = '1px ' + color[3] + ' solid';
}
function subMenu_Hide(hide) {
for (var i=0; i<subMenu.length; i++)
subMenu[i].style.display = 'none';
sub_display = hide;
}
function subMenu_Show(obj, s) {
subMenu_Hide(false);
subMenu(s).style.posLeft = obj.offsetLeft + 6;
subMenu(s).style.display = '';
sub_display = true;
}
window.onfocus = subMenu_Hide;
</script>
=-=======================-----------------========================================

模仿OUTLOOK的菜單:
<head>
<style type="text/css">
.titleStyle{
background-color:#3366cc;color:#ffffff;border-top:1px solid #FFFFFF;font-size:9pt;cursor:hand;
}
.contentStyle{
background-color:#efefef;color:blue;font-size:9pt;
}
a{
color:blue;
}
body{
font-size:9pt;
}
</style>
</head>
<body>
<script language="JavaScript">
<!--
var layerTop=20; //菜單頂邊距
var layerLeft=30; //菜單左邊距
var layerWidth=140; //菜單總寬
var titleHeight=20; //標題欄高度
var contentHeight=200; //內容區高度
var stepNo=10; //移動步數,數值越大移動越慢
var itemNo=0;runtimes=0;
document.write('<span id=itemsLayer style="position:absolute;overflow:hidden;border:1px solid #efefef;left:'+layerLeft+';top:'+layerTop+';width:'+layerWidth+';">');
function addItem(itemTitle,itemContent){
itemHTML='<div id=item'+itemNo+' itemIndex='+itemNo+' style="position:relative;left:0;top:'+(-contentHeight*itemNo)+';width:'+layerWidth+';"><table width=100% cellspacing="0" cellpadding="0">'+
'<tr><td height='+titleHeight+' onclick=changeItem('+itemNo+') class="titleStyle" align=center>'+itemTitle+'</td></tr>'+
'<tr><td height='+contentHeight+' class="contentStyle">'+itemContent+'</td></tr></table></div>';
document.write(itemHTML);
itemNo++;
}
//添加菜單標題和內容,可任意多項,注意格式:
addItem('歡迎','<BR>  WWW.CNBRUCE.COM');
addItem('網頁專區','<center><a href="#">網頁工具</a> <BR><BR><a href="#">技術平臺</a> <BR><BR><a href="#">設計理念</a> <BR><BR><a href="#">更多</a></center>');
addItem('美工教室','<center><a href="#">平面設計 </a> <BR><BR><a href="#">三維空間</a> <BR><BR><a href="#">設計基礎</a> <BR><BR><a href="#">更多..</a></center>');
addItem('Flash','<center><a href="#">基礎教程</a> <BR><BR><a href="#">技巧運用</a> <BR><BR><a href="#">實例剖析</a> <BR><BR><a href="#">更多..</a></center>');
addItem('多媒體','<center><a href="#">DIRECTOR</a> <BR><BR><a href="#">Authorware</a> <BR><BR><a href="#">更多..</a></center>');
addItem('精品賞析','<center><a href="#">設計精品</a></center>');
document.write('</span>')
document.all.itemsLayer.style.height=itemNo*titleHeight+contentHeight;
toItemIndex=itemNo-1;onItemIndex=itemNo-1;
function changeItem(clickItemIndex){
toItemIndex=clickItemIndex;
if(toItemIndex-onItemIndex>0) moveUp(); else moveDown();
runtimes++;
if(runtimes>=stepNo){
onItemIndex=toItemIndex;
runtimes=0;}
else
setTimeout("changeItem(toItemIndex)",10);
}
function moveUp(){
for(i=onItemIndex+1;i<=toItemIndex;i++)
eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)-contentHeight/stepNo;');
}
function moveDown(){
for(i=onItemIndex;i>toItemIndex;i--)
eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)+contentHeight/stepNo;');
}
changeItem(0);
//-->
</script>
</body>

專業設計團隊
滿足您的各種設計要求
實力程序開發團隊
為您定制各種程序模塊
后臺管理高效安全
方便更新上傳網站資料
全球高速訪問
無盲區、定制異地備份
專業客服團隊
解決一切使用難題
贈送大容量空間郵箱
免費優化推廣
   
關于我們 | 工作機會 | 付款方式 | 網站制作 | 網頁制作 | 網頁設計 | 網絡公司 | 聯系我們 | 網站地圖
版權所有:聊城精英網絡科技有限公司 © 2005-2010 All Rights Reserved.
咨詢專線:0635-6950368 技術專線:15192175820 在線QQ:312817927 1485871644
地址:聊城市閘口科技市場 郵編:252000 蘇ICP備10112026號
主站蜘蛛池模板: 亚洲精品久久久WWW游戏好玩 | 国产又粗又长又大精品A片 国产又粗又长又硬又猛A片 | 99精品免视看 | 国产免费高潮白浆二区三区 | 亚洲av无码久久精品成人 | 精品动漫无码在线一区二区三区 | 欧美日本韩国国产一区 | 国产传媒一区二区三区四区五区 | 女人夜夜春高潮爽a∨片 | 精品人妻伦一二三区久久 | 蜜桃视频一区二区在线观看 | 久久精品视频在线直播6 | 亚洲欧美国产精品久久久 | 亚洲国产精品第一区二区三 | 久久亚洲精品情侣 | 亚洲国产女人综合1区2区 | 精品日韩二区三区精品视频 | 大胆国模GOGO人体私拍 | 麻豆2国产巨作浮生影院 | 国产精品色情国产三级在 | 麻豆久久婷婷五月综合国产 | 亚洲乱色熟女一区二区三区丝袜 | 亚洲另类欧美综合久久 | 日韩区欧美 | 亚洲午夜久久久影院 | 国产真实偷乱视频 | 乱码丰满人妻一二三区麻豆 | 天堂 亚洲 av 日韩 | 亚洲国产精品无码久久夜夜嗨av | av无码一区二区三区鸳鸯影院 | 亚洲bt成人 | 亚洲三级香港三级久久 | 国产成人无码a区在线观看导航 | 伊人网综合网 | 国产丝袜美女一区二区三区 | 亚洲人妻精品一区 | 日韩欧美一区二区三区在线视频 | 7799精品視頻免費觀看 | 亚洲午夜理论片av大片 | 亚洲韩国欧美一区二区三区 | 日日夜夜7799综合网 |