本文實例講述了JS實作仿雅虎首頁快速登入入口及導覽模組效果。分享給大家供大家參考。具體如下:
這是一款JS實作仿雅虎首頁網站快速入口導航模組的程式碼,裡面有使用者登入框,這個大家或許會用上吧,放到你網站著頁作為使用者登入也挺行。
運作效果截圖如下:
線上示範網址如下:
http://demo.jb51.net/js/2015/js-f-yahoo-index-login-style-codes/
具體程式碼如下:
<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>仿雅虎首页网站快捷入口和快</title> <style> *{ margin:0; padding:0; border:none;} body{font:12px/130% verdana,geneva,arial,helvetica,sans-serif; height:100%;}li{list-style:none;} html{ height:100%;} .clearfix:after{content:" ";display:block;height:0;clear:both;visibility:hidden;}.clearfix{display:inline-block;} a:link{ color:#000; text-decoration:none; } a:visited{ color:#000; text-decoration:none; } a:hover{ color:#000; text-decoration:none; } .rrow{width:224px;} .login{ background:url(images/box.png); height:210px;width:224px; overflow:hidden;} .login h2{ color:#fff; font-size:14px; padding:4px 12px; line-height: 30px;height:24px; overflow:hidden; } .login h2 span{ font-size:12px; float:right;margin:-31px 23px 0 0;line-height: 32px;font-weight:400; cursor:pointer;} .rrow ul{ margin:5px 6px; } .rrow ul li {width:216px; height:31px;margin-bottom: 5px; overflow:hidden; float:left;} .rrow ul li a,.rrow ul li span{ cursor:pointer; display:block; float:left; margin-right: 4px; background:url(images/title.gif) 0 -152px; width:69px;padding-left:35px; height:31px; overflow:hidden; line-height: 32px; font-weight:700;} .rrow ul li .lhover{ display:block; float:left; margin-right: 4px; background:url(images/title.gif) 0 -183px; width:69px;padding-left:35px; height:37px; overflow:hidden; line-height: 32px; font-weight:700;} .rrow ul li .yhzc{ background:url(images/title.gif) 0 -152px;} #yhzc{background:url(images/title.gif) 0 -183px;height:37px;} .rrow ul li .hysj{ background:url(images/title.gif) -104px -152px; } #hysj{ background:url(images/title.gif) -104px -183px;height:37px;} .rrow ul li .fbxx{ background:url(images/title.gif) 0 -220px; } #fbxx{ background:url(images/title.gif) 0 -251px;height:37px;} .rrow ul li .gstg{ background:url(images/title.gif) -104px -220px; } #gstg{ background:url(images/title.gif) -104px -251px;height:37px;} .rrow ul li .xzmj{ background:url(images/title.gif) 0 -288px; } #xzmj{ background:url(images/title.gif) 0 -319px;height:37px;} .rrow ul li .bzzx{ background:url(images/title.gif) -104px -288px; } #bzzx{ background:url(images/title.gif) -104px -319px;height:37px;} .rrow ul .hoverli{background:url(images/title.gif) 0 -357px;height:92px; overflow:hidden; line-height: 32px; font-weight:700;} .qlogin{height:92px; width:210px; line-height: 32px; margin:5px 0 0 10px; display:none;} .qlogin dt{ height:0; overflow:hidden; } .qlogin dd{ padding:4px; width:210px; height:22px; text-align:left; float:left;clear:both;overflow:hidden;} .qlogin dd .passw,.qlogin a:hover.passw{ margin: -4px 12px 0 0; float:right;} .rrow ul li div{ margin-top: 5px; width:210px; display:none;} .rrow ul li div a,.rrow ul li div a:hover{background:url(images/title.gif) -80px -1px; height:20px; line-height: 20px; clear:both; font-weight: 400; width:170px;} .rrow ul li div a:hover{ text-decoration:underline; } .rrow ul li .block,.rrow .block{ display:block; } .rrow ul .none{ display:none; } .btn{font-size:12px; font-family:宋体; float:left; width:57px; height:20px; overflow:hidden; background:url(images/title.gif); line-height: 21px;padding-left:18px;margin-right: 10px; } a:hover.btn{background:url(images/title.gif) 0 -20px;} #btn4{background:url(images/title.gif);width:75px; margin-left: 48px; cursor:pointer;} .input2{font-size:12px; border:1px solid #999; width:140px; height:16px; padding:1px 2px 0 2px; } </style> </head> <body> <table width="18%" height="420" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><div class="rrow"> <div id="login" class="login"> <h2 id="便捷入口-span-a-class-w-title-快速登陆-快速登陆-a-span">便捷入口<span><a class="w" title="快速登陆">快速登陆</a></span></h2> <dl class="qlogin clearfix"> <dt>快速登陆</dt> <dd>用户名: <input name="text" type="text" class="input2" /> </dd> <dd>密 码: <input name="password" type="password" class="input2" /> </dd> <dd> <input name="submit" type="submit" class="btn" id="btn4" value="立即登陆" /> <a class="passw" href="#" target="_blank">忘记密码?</a></dd> </dl> <ul> <li id="btype1" class="hoverli"><span class="yhzc" id="yhzc" href="#" target="_blank" title="用户注册">用户注册</span><span class="hysj" href="#" target="_blank" title="会员升级">会员升级</span> <div class="block"><a href="#" target="_blank">1...</a><a href="#" target="_blank">1...</a></div> <div><a href="#" target="_blank">2...</a><a href="#" target="_blank">2...</a></div> </li> <li id="btype2"><span class="fbxx" href="#" target="_blank" title="发布信息">发布信息</span><span class="gstg" href="#" target="_blank" title="公司推广">公司推广</span> <div><a href="#" target="_blank">3...</a><a href="#" target="_blank">3...</a></div> <div><a href="#" target="_blank">4...</a><a href="#" target="_blank">4...</a></div> </li> <li id="btype3"><span class="xzmj" href="#" target="_blank" title="寻找买家">寻找买家</span><span class="bzzx" href="#" target="_blank" title="帮助中心">帮助中心</span> <div><a href="#" target="_blank">5...</a><a href="#" target="_blank">5...</a></div> <div><a href="#" target="_blank">6...</a><a href="#" target="_blank">6...</a></div> </li> </ul> </div> <script type=text/javascript> var login = document.getElementById("login"); var yhzc = document.getElementById("yhzc"); var h2 = login.getElementsByTagName("h2"); var dl = login.getElementsByTagName("dl"); var ul = login.getElementsByTagName("ul"); var lis = ul[0].getElementsByTagName("li"); var allspan = ul[0].getElementsByTagName("span"); var qlog = h2[0].getElementsByTagName("a"); var divs = login.getElementsByTagName("div"); qlog[0].onclick = function() { for(var i = 0; i < divs.length; i++) {divs[i].className = null;} for(var i = 0; i < allspan.length; i++) {allspan[i].id = null;} lis[0].className = "none"; dl[0].className = "qlogin block"; } for(var x = 1; x < 4; x++) {show();} function show() { var test = "btype" +x; var btype = document.getElementById("btype" + x); var as = btype.getElementsByTagName("a"); var bdivs = btype.getElementsByTagName("div"); var spans = btype.getElementsByTagName("span"); for(var i = 0; i < spans.length; i++) { spans[i].num = i; spans[i].onmouseover = type; } function type() { for(var i = 0; i < lis.length; i++) {lis[i].className = null;} for(var i = 0; i < allspan.length; i++) {allspan[i].id = null;} for(var i = 0; i < divs.length; i++) {divs[i].className = null;} dl[0].className = "qlogin"; yhzc.id = null; spans[this.num].id = spans[this.num].className; bdivs[this.num].className = "block"; btype.className = "hoverli"; } } </script> </div> </td> </tr> </table> </body> </html>
希望本文所述對大家的JavaScript程式設計有所幫助。

Python和JavaScript的主要區別在於類型系統和應用場景。 1.Python使用動態類型,適合科學計算和數據分析。 2.JavaScript採用弱類型,廣泛用於前端和全棧開發。兩者在異步編程和性能優化上各有優勢,選擇時應根據項目需求決定。

選擇Python還是JavaScript取決於項目類型:1)數據科學和自動化任務選擇Python;2)前端和全棧開發選擇JavaScript。 Python因其在數據處理和自動化方面的強大庫而備受青睞,而JavaScript則因其在網頁交互和全棧開發中的優勢而不可或缺。

Python和JavaScript各有優勢,選擇取決於項目需求和個人偏好。 1.Python易學,語法簡潔,適用於數據科學和後端開發,但執行速度較慢。 2.JavaScript在前端開發中無處不在,異步編程能力強,Node.js使其適用於全棧開發,但語法可能複雜且易出錯。

javascriptisnotbuiltoncorc; sanInterpretedlanguagethatrunsonenginesoftenwritteninc.1)JavascriptwasdesignedAsignedAsalightWeight,drackendedlanguageforwebbrowsers.2)Enginesevolvedfromsimpleterterpretpretpretpretpreterterpretpretpretpretpretpretpretpretpretcompilerers,典型地,替代品。

JavaScript可用於前端和後端開發。前端通過DOM操作增強用戶體驗,後端通過Node.js處理服務器任務。 1.前端示例:改變網頁文本內容。 2.後端示例:創建Node.js服務器。

選擇Python還是JavaScript應基於職業發展、學習曲線和生態系統:1)職業發展:Python適合數據科學和後端開發,JavaScript適合前端和全棧開發。 2)學習曲線:Python語法簡潔,適合初學者;JavaScript語法靈活。 3)生態系統:Python有豐富的科學計算庫,JavaScript有強大的前端框架。

JavaScript框架的強大之處在於簡化開發、提升用戶體驗和應用性能。選擇框架時應考慮:1.項目規模和復雜度,2.團隊經驗,3.生態系統和社區支持。

引言我知道你可能會覺得奇怪,JavaScript、C 和瀏覽器之間到底有什麼關係?它們之間看似毫無關聯,但實際上,它們在現代網絡開發中扮演著非常重要的角色。今天我們就來深入探討一下這三者之間的緊密聯繫。通過這篇文章,你將了解到JavaScript如何在瀏覽器中運行,C 在瀏覽器引擎中的作用,以及它們如何共同推動網頁的渲染和交互。 JavaScript與瀏覽器的關係我們都知道,JavaScript是前端開發的核心語言,它直接在瀏覽器中運行,讓網頁變得生動有趣。你是否曾經想過,為什麼JavaScr


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

mPDF
mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

記事本++7.3.1
好用且免費的程式碼編輯器

MantisBT
Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

禪工作室 13.0.1
強大的PHP整合開發環境