Today, in the improvement of the project to participate in a national competition, found that the use of a large number of alert and comfirm, so I want to achieve a pop-up graphical dialog box, which will become very friendly, because time is not much, directly paste code, share
varboardDiv = "<div id='message' style='display:none;'><span id='spanmessage'></span></div>"; |
$(document.body).append(boardDiv); |
$("#spanmessage").text(text); |
//说明callback是如果要选择是,要执行的方法 |
functionqueren(text, callback) { |
$("#spanmessage").text(text); |
Using the example (an example of a static deletion feature)
1, first reference jquery Couroux (<script src= "http://www.cnblogs.com/js/jquery-1.4.2.js" type= "text/Web Effects" ></script>)
2. In reference to the jquery UI Library
<link href= ". /css Tutorial/css/ui-lightness/jquery-ui-1.8.2.custom.css "rel=" stylesheet "
Type= "Text/css"/>
<script src= ". /js/jquery-ui-1.8.2.custom.min.js "type=" Text/javascript "></script>
$("a[delete=true]").click(function() { |
var id = $(this).attr("curId"); |
queren("确认要删除吗?", function() { |
$.post("productDel.ashx", { "action": "delete", "id": id }, function(data, status) { |
$("a[curId='"+ id + "']").parent().parent().parent().parent().remove(); |
See how it works (No art yet)