日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

jsp自定义alert

發(fā)布時間:2023/12/10 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 jsp自定义alert 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

普通alert

?alert(data.msg);

自定義alert

1、創(chuàng)建彈出框div

?<!--彈出框--------------------------->
? ? ? ? ? ?<div id="alert_div" align="center">
? ? ? ? ? ? ? ? ? ?<div align="left">操作提示</div>
? ? ? ? ? ? ? ? ? ?<div align="center">context</div>
? ? ? ? ? ? ? ? ? ?<div align="right">
?? ??? ??? ??? ??? ? <!-- <a href="javascript:;">確定</a> -->
?? ??? ??? ??? ??? ? <button id="alertbutton">確定</button>
?? ??? ??? ??? ??? ?</div>
? ? ? ? ? ?</div>

?

2、定義樣式以及初始化隱藏alert

? ? <script type="text/javascript">
? ?? ??? ? $(function(){

? ? ? ?$('.background,#alert_div').hide();

?? ? ? ? ? ? ? ? //position:fixed; absolute
?? ? ? ? ? ? ? ? $('#alert_div').css('width',300).css('height',120).css('border','0.1px solid #666666')
?? ? ? ? ? ? ? ? .css('position','fixed').css('left',$(this).width()/2.5).css('top',$(this).height()/2.5)
?? ? ? ? ? ? ? ? .css('z-index','120').css('background-color','#ffffff').css('border-radius','5px');
?? ? ? ? ? ? ? ? $('#alert_div div:eq(0)').css('margin-left','10px').css('margin-top','10px').css('text-decoration','underline');
?? ? ? ? ? ? ? ? $('#alert_div div:eq(2)').css('margin-top','25px').css('margin-right','10px');
?? ? ? ? ? ? ? ? $('#alert_div div:eq(2) button').click(function(){
?? ? ? ? ? ? ? ??? ? ? ? $('.background').fadeOut(150);
?? ? ? ? ? ? ? ??? ? ? ? $('#alert_div').fadeOut(350);
?? ? ? ? ? ? ? ? });
?? ? ? ? ? ? ? ? $('#alert_div div:eq(1)').css('margin-top','10px');

?

? ? ?? ??? ? });
? </script>

?

3、同樣在script里面。點擊事件、設置alert內(nèi)容。顯示alert

? $('#alert_div div:eq(1)')
? ?? ??? ? ?? ??? ??? ??? ??? ? .text(''+data.msg).css('color','red');
? ?? ??? ? ?? ??? ??? ??? ??? ? ?$('#alert_div').fadeIn('150');

?

總結(jié)

以上是生活随笔為你收集整理的jsp自定义alert的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。