本文實(shí)例講述了jQuery簡(jiǎn)單實(shí)現(xiàn)提交數(shù)據(jù)出現(xiàn)loading進(jìn)度條的方法。分享給大家供大家參考,具體如下:
html部分代碼如下,復(fù)制然后引入類庫(kù)即可使用
<html><head><style type="text/css"> #bg{ display: none; position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index:1001; -moz-opacity: 0.2; opacity:.2; filter: alpha(opacity=70);} .loading{display: none; position: absolute; top: 50%; left: 50%; z-index:1002; } </style></head><body> <div id="bg"></div> <input type="button" value="Save" id="btnSave" name="btnSave" /> <div class="loading"><img src="loading.gif"></div></body></html>jQuery部分代碼如下:
<script src="jquery-1.11.0.min.js" type="text/javascript"></script><!--自己下載類庫(kù)--><script type="text/javascript">$(function(){ $("#btnSave").click(function(){ $("#bg,.loading").show(); $.ajax({ async:false, url:"time.php", type:"post", data:{}, success:function(mes){ $("#bg,.loading").show(); } }) })})</script>php代碼:
for($i=0;$i<10000000;$i++){}更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery切換特效與技巧總結(jié)》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常見(jiàn)經(jīng)典特效匯總》、《jQuery動(dòng)畫(huà)與特效用法總結(jié)》、《jquery選擇器用法總結(jié)》及《jQuery常用插件及用法總結(jié)》
希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注