自制弹出框--公告消息

来源:互联网 发布:程序员高级证书如何考 编辑:程序博客网 时间:2024/05/23 19:24

//消息标题的list

<input type="button" onclick="news(${bn.id});" title="查看详情" value="${bn.title }"/>


//弹出框-先隐藏

<div class="popup edit_data_popup" id="newsDetail" style="width:700px;height:350px;left:50%;top:20%;margin-left:-325px;display: none;">
    </div>


//JS--显示弹出,组装标题和内容、关闭按钮

function news(id){
$.ajax({
type : "POST",
url:"${path}/bulletinNews/newsDetail.do",
        dataType: 'json',//返回数据的类型  
        data:{id:id},
        success: function (data) {
        $("#newsDetail").html("");
        var html = "<div class='popup_top'><span></span><b class='popup_title'>"+data.o.title+"</b></div>";
            html += "<div class='popup_main'><div class='popup_txt align_center'>"+data.o.content+"</div></div>";
            html += "<div class='popup_bottom align_center'><input type='reset' onclick='exit();' value='关闭'/></div>";
            $("#newsDetail").append(html);
        $("#newsDetail").show();
        }
    });
}
function exit(){
$("#newsDetail").hide();
}


原创粉丝点击