欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Bootstrap模態(tài)框調(diào)用功能實現(xiàn)方法

 更新時間:2016年09月19日 17:01:25   作者:myxp  
這篇文章主要介紹了Bootstrap模態(tài)框調(diào)用功能實現(xiàn)方法的相關(guān)資料,非常不錯,具有參考借鑒價值,感興趣的朋友一起看看吧

近在做一個項目時需要在頁面中嵌入彈出窗口,用來展示表單信息。其實這種彈出窗口有很多jquery插件都可以實現(xiàn),我這邊前端都是用Bootstrap的,正好Bootstrap有模態(tài)框這個功能,這下就可以直接拿它實現(xiàn)了。

實現(xiàn)步驟如下:

在前端頁面引入bootstrap相關(guān)的css和js文件

<link rel="stylesheet" > 
<script type='text/javascript' src='../public/js/jquery-1.8.2.min.js'></script> 
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script> 
<script src="http://cdn.bootcss.com/bootstrap/2.3.1/js/bootstrap-transition.js"></script> 
<script src="http://cdn.bootcss.com/bootstrap/2.3.1/js/bootstrap-modal.js"></script>

然后在html中創(chuàng)建一個button用來點擊觸發(fā)彈出窗口,這里是調(diào)用f_show函數(shù)并傳入一個參數(shù)向后端發(fā)起Ajax請求,Ajax處理請求后返回前端并輸出到模態(tài)框。

<td><button type="button" data-toggle="modal" data-target="#myModal" onclick="f_show('<?php echo $row['service_tag'];?>');" ><?php echo $row['service_type'];?></button></td>

Ajax處理請求

<script> 
function f_show(tags){ 
$.ajax({ 
type:"POST", 
url:"service_info_ajax.php", 
data: {"tags":tags}, 
dataType:'json', 
success: function(data){ 
if(data.state == '1'){ 
$("#service_key").val(data.service_key); 
$("#service_comments").val(data.service_comments); 
$("#service_help").val(data.service_help); 
$("#service_target").val(data.service_target); 
$("#service_mail").val(data.service_mail); 
$("#service_mailpass").val(data.service_mailpass); 
$("#service_date").val(data.service_date); 
if(data.service_type <= '2'){ 
document.getElementById("remark1").style.display = "none";
document.getElementById("remark2").style.display = "none";
document.getElementById("notes1").style.display = ""; 
document.getElementById("notes2").style.display = ""; 
$("#notes2").text(data.service_notes); 
}else{ 
document.getElementById("notes1").style.display = "none"; 
document.getElementById("notes2").style.display = "none"; 
document.getElementById("remark1").style.display = ""; 
document.getElementById("remark2").style.display = ""; 
$("#remark2").text(data.service_remark); 
} 
} 
}, 
}); 
} 
$('#myModal').modal(options); 
</script>

后端處理返回

<?php
require_once("../db.class.php");
require_once("../common.class.php");
require_once("../mailtmp.class.php");
require_once("../admin.class.php");
$obj_comm = new Comm();
$obj_mail = new mailtemplate();
$obj_admin = new AdminSub();
$tags = trim($_POST['tags']);
#$tags = "1643e0cb3d6078a9a0fd86c8239cd4c1";
$tag_arr = $obj_admin->find_service_tag($tags,$db);
if($tag_arr){
$tag_arr['state'] = 1;
echo json_encode($tag_arr);
}
?>

前端模態(tài)框頁面展示

<!--模態(tài)框開始--><div class="modal fade" role="dialog" aria-labelledby="gridSystemModalLabel" id="myModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="gridSystemModalLabel">Service</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="uk-form-row">
<div class="uk-form-controls">
<label for="form-username" class="uk-form-label" style="display:inline-block;padding: 0 10px;vertical-align: middle;margin-left:-7px;">研究關(guān)鍵字</label>
<input class="" id="service_key" value="<?php echo $ids;?>" readonly="readonly" style="margin-left: 5px;width:400px;height:30px;" type="text" name="service_help" placeholder="">
</div>
</div>
<div class="uk-form-row">
<div class="uk-form-controls"> <label for="form-username" class="uk-form-label" style="display:inline-block;padding: 0 10px;vertical-align: middle;margin-left:7px;">評審意見</label>
<input class="" id="service_comments" readonly="readonly" style="margin-left: 5px;width:400px;height:30px;" type="text" name="service_help" placeholder=""> </div>
</div>
<div class="uk-form-row">
<div class="uk-form-controls">
<label for="form-username" class="uk-form-label" style="display:inline-block;padding: 0 10px;vertical-align: middle;margin-left:7px;">幫助選刊</label>
<input class="" id="service_help" readonly="readonly" style="margin-left: 5px;width:400px;height:30px;" type="text" name="service_help" placeholder="">
</div>
</div>
<div class="uk-form-row">
<div class="uk-form-controls">
<label for="form-username" class="uk-form-label" style="display:inline-block;padding: 0 10px;vertical-align: middle;margin-left:7px;">投稿服務(wù)</label>
<input class="" id="service_target" readonly="readonly" style="margin-left: 5px;width:400px;height:30px;" type="text" name="service_help" placeholder="">
</div>
</div>
<div class="uk-form-row">
<div class="uk-form-controls">
<label for="form-username" class="uk-form-label" style="display:inline-block;padding: 0 10px;vertical-align: middle;margin-left:7px;">投稿郵箱</label>
<input class="" id="service_mail" readonly="readonly" style="margin-left:5px;width:400px;height:30px;" type="text" name="service_help" placeholder="">
</div>
</div>
<div class="uk-form-row">
<div class="uk-form-controls">
<label for="form-username" class="uk-form-label" style="display:inline-block;padding: 0 10px;vertical-align: middle;margin-left:7px;">郵箱密碼</label>
<input class="" id="service_mailpass" readonly="readonly" style="margin-left: 5px;width:400px;height:30px;" type="text" name="service_help" placeholder="">
</div>
</div>
<div class="uk-form-row">
<div class="uk-form-controls">
<label for="form-username" class="uk-form-label" style="display:inline-block;padding: 0 10px;vertical-align: middle;margin-left:7px;">投稿加急</label>
<input class="" id="service_date" readonly="readonly" style="margin-left: 5px;width:400px;height:30px;" type="text" name="service_help" placeholder="">
</div>
</div>
<div class="uk-form-row" style="display:inline-block;">
<div class="uk-form-controls">
<label for="form-username" id="notes1" class="uk-form-label" style="display:none;padding: 0 10px;vertical-align: middle;margin-left:7px;margin-top:-150px;">改寫需求</label>
<textarea cols="20" rows="3" readonly="readonly" style="display:none;margin-left: 5px;px; height: 100px; width: 400px;" name="service_notes" id="notes2" placeholder=""></textarea>
<label for="form-username" id="remark1" class="uk-form-label" style="display:none;padding: 0 10px;vertical-align: middle;margin-left:7px;margin-top:-150px;">投稿備注</label>
<textarea cols="20" rows="3" readonly="readonly" style="display:none;margin-left: 5px;px; height: 100px; width: 400px;" name="service_notes" id="remark2" placeholder=""></textarea>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!--模態(tài)框結(jié)束-->

實現(xiàn)效果如圖:

以上所述是小編給大家介紹的Bootstrap模態(tài)框調(diào)用功能實現(xiàn)方法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

  • javascript 正則表達(dá)式去空行方法

    javascript 正則表達(dá)式去空行方法

    本文主要介紹了javascript 正則表達(dá)式去空行方法。具有很好的參考價值,下面跟著小編一起來看下吧
    2017-01-01
  • BootStrap TreeView使用實例詳解

    BootStrap TreeView使用實例詳解

    這篇文章主要為大家詳細(xì)介紹了BootStrap TreeView使用實例,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-11-11
  • JS繼承用法實例分析

    JS繼承用法實例分析

    這篇文章主要介紹了JS繼承用法,實例分析了拷貝繼承、類繼承及原型繼承等的使用技巧,需要的朋友可以參考下
    2015-02-02
  • 詳解JavaScript中的Unescape()和String() 函數(shù)

    詳解JavaScript中的Unescape()和String() 函數(shù)

    這篇文章主要介紹了詳解JavaScript中的unescape()和String() 函數(shù),JavaScript unescape() 函數(shù)可對通過 escape() 編碼的字符串進(jìn)行解碼,String() 函數(shù)把對象的值轉(zhuǎn)換為字符串,對本文感興趣的朋友一起學(xué)習(xí)吧
    2015-11-11
  • javascript和jquery實現(xiàn)設(shè)置和移除文本框默認(rèn)值效果代碼

    javascript和jquery實現(xiàn)設(shè)置和移除文本框默認(rèn)值效果代碼

    這篇文章主要介紹了javascript和jquery實現(xiàn)設(shè)置和移除文本框默認(rèn)值效果代碼,本文實現(xiàn)的是類似html5 placeholder(空白提示)一種效果,需要的朋友可以參考下
    2015-01-01
  • JavaScript將數(shù)組轉(zhuǎn)換成CSV格式的方法

    JavaScript將數(shù)組轉(zhuǎn)換成CSV格式的方法

    這篇文章主要介紹了JavaScript將數(shù)組轉(zhuǎn)換成CSV格式的方法,實例分析了javascript使用valueOf方法將數(shù)組值轉(zhuǎn)換為csv格式字符串的技巧,非常具有實用價值,需要的朋友可以參考下
    2015-03-03
  • JavaScript中的函數(shù)模式詳解

    JavaScript中的函數(shù)模式詳解

    這篇文章主要介紹了JavaScript中的函數(shù)模式詳解,本文講解了創(chuàng)建函數(shù)的語法、函數(shù)表達(dá)式、命名函數(shù)表達(dá)式、函數(shù)的聲明、函數(shù)聲明與表達(dá)式、函數(shù)的提升、即時函數(shù)模式等內(nèi)容,需要的朋友可以參考下
    2015-02-02
  • JavaScript可折疊區(qū)域?qū)崿F(xiàn)代碼

    JavaScript可折疊區(qū)域?qū)崿F(xiàn)代碼

    可折疊區(qū)域的基本思想:通過點擊某個地方來顯示或隱藏屏幕中的某個區(qū)域。
    2010-10-10
  • js實現(xiàn)隨機(jī)點名程序

    js實現(xiàn)隨機(jī)點名程序

    這篇文章主要為大家詳細(xì)介紹了js實現(xiàn)隨機(jī)點名程序,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-11-11
  • 使用JavaScript實現(xiàn)一個炫酷的羅盤時鐘

    使用JavaScript實現(xiàn)一個炫酷的羅盤時鐘

    在探究前端動畫時,想到之前在鎖屏壁紙看到的羅盤時鐘,看著很是炫酷,于是說干就干,下面就跟隨小編一起來學(xué)習(xí)一下如何使用JS實現(xiàn)一個炫酷的羅盤時鐘效果吧
    2024-02-02

最新評論