[英]how to add bootstrap-alert box inside a javascript?
我有一個帶警報的JavaScript框,當以錯誤的尺寸上傳圖像時會說一些文本。我想將該警報顯示為Bootstrap警報而不是彈出窗口?
我有一個單獨的JavaScript文件。
在Bootstrap中,它們不稱為“彈出窗口”,而是模式。 它具有相同的一般原理(向用戶發送警報到屏幕上進行交互),但更加美觀。 請參閱下面的鏈接,以獲取有關模態以及代碼(功能齊全)的更多信息。 希望這可以幫助。 -Jusitn
鏈接: http : //www.w3schools.com/bootstrap/bootstrap_modal.asp
編輯:別忘了添加引導CDN使其在您的head標簽之間工作(CSS和Javascript CDN)
CDN可以在這里找到: http : //www.bootstrapcdn.com/
碼:
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.