jQuery實(shí)現(xiàn)選中彈出窗口選擇框內(nèi)容后賦值給文本框的方法
681
2024-03-20
本文實(shí)例講述了jquery實(shí)現(xiàn)簡單實(shí)用的彈出層效果。分享給大家供大家參考。具體如下:
目前來說,我還是喜歡這個(gè)自己改造的彈出層,在項(xiàng)目中用的也是這個(gè)。引入了新版的jquery插件,方框及文字都可以自己定義,非常方便,希望大家也喜歡這款彈出層,JavaScript在本例中也充分發(fā)揮了作用,對學(xué)習(xí)JS也是不錯(cuò)的參考。
運(yùn)行效果截圖如下:
在線演示地址如下:
http://demo.gimoo.net/js/2015/jquery-simple-alert-style-demo/
具體代碼如下:
<!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>彈出層</title> <script src="http://www.gimoo.net/t/1904/jquery-1.6.2.min.js" type="text/javascript"></script> <style> .black_overlay{ display: none; position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index:1001; -moz-opacity: 0.8; opacity:.80; filter: alpha(opacity=80); } .white_content { display: none; position: absolute; top: 10%; left: 10%; width: 80%; height: 80%; border: 16px solid lightblue; background-color: white; z-index:1002; overflow: auto; } .white_content_small { display: none; position: absolute; top: 20%; left: 30%; width: 40%; height: 50%; border: 16px solid lightblue; background-color: white; z-index:1002; overflow: auto; } </style> <script type="text/javascript"> //彈出隱藏層 function ShowDiv(show_div,bg_div){ document.getElementById(show_div).style.display='block'; document.getElementById(bg_div).style.display='block' ; var bgdiv = document.getElementById(bg_div); bgdiv.style.width = document.body.scrollWidth; // bgdiv.style.height = $(document).height(); $("#"+bg_div).height($(document).height()); }; //關(guān)閉彈出層 function CloseDiv(show_div,bg_div) { document.getElementById(show_div).style.display='none'; document.getElementById(bg_div).style.display='none'; }; </script> </head> <body> <input id="Button1" type="button" value="點(diǎn)擊彈出層" onclick="ShowDiv('MyDiv','fade')" /> <彈出層時(shí)背景層DIV--> <div id="fade" class="black_overlay"> </div> <div id="MyDiv" class="white_content"> <div style="text-align: right; cursor: default; height: 40px;"> <span style="font-size: 16px;" onclick="CloseDiv('MyDiv','fade')">關(guān)閉</span> </div> 目前來說,我還是喜歡這個(gè)自己改造的彈出層。自己在項(xiàng)目中也用的是這個(gè)。 </div> </body> </html>
希望本文所述對大家的jquery程序設(shè)計(jì)有所幫助。
#免責(zé)聲明#
本站[綠夏技術(shù)導(dǎo)航]提供的一切軟件、教程和內(nèi)容信息僅限用于學(xué)習(xí)和研究目的;不得將上述內(nèi)容用于商業(yè)或者非法用途,否則,一切后果請用戶自負(fù)。本站信息來自網(wǎng)絡(luò)收集整理,版權(quán)爭議與本站無關(guān)。您必須在下載后的24個(gè)小時(shí)之內(nèi),從您的電腦或手機(jī)中徹底刪除上述內(nèi)容。如果您喜歡該程序或內(nèi)容,請支持正版,購買注冊,得到更好的正版服務(wù)。我們非常重視版權(quán)問題,如有侵權(quán)請郵件[admin@lxwl520.com]與我們聯(lián)系進(jìn)行刪除處理。敬請諒解!