stingray中modal window

自定义内容modal window

//show window for D&B suggestions
function showDBMatch(resp) {
    console.log('xxx: ', resp);
    html = '';
    for (var i = 0; i < resp.length - 1; i++) {
        html += '<div class="match" style="" title="Please click to select this match.">'
        html += '    <span>' + resp[i].DUNS + '</span>'
        html += '    <br>'
        html += '    <span>' + resp[i].BusinessName + '</span>'
        html += '    <br>'
        html += '    <span>' + resp[i].YearStarted + '</span>'
        html += '    <br>'
        html += '    <span>' + resp[i].SIC + ': ' + resp[i].SIC_Desc + '</span>'
        html += '    <br>'
        html += '</div>'
    }

    html += '<div style="clear:both"></div>'
    html += '<div style="margin-top: 20px; text-align: left; margin-left: 10px;">'
    html += '    <button id="DBNoMatchBtn">None of these match</button>'
    html += '</div>'

    var $dialogW = $("<div id='DBBox' style=''></div>").html(html).dialog({
        title: 'Business Match(es)',
         660,
        height: 300,
        modal: true,
        autoOpen: false,
        close: function(ev, ui) {
            $(this).dialog("destroy");
        },
        // buttons: {
        //     Cancel: function() {
        //         $(this).dialog("destroy");
        //         return false;
        //     }
        // }
    });

    $dialogW.dialog("open");

    // bind btn click
    $('#DBNoMatchBtn').die().live('click',function(){
        $dialogW.dialog("destroy");
    });

    //bind match select 
    $('#DBBox .match').die().live('click', function(){
        console.log('match: ',$(this).html());
        $('#PQ_DUNS_No').val($(this).find('span').eq(0).text())
        $('#PQ_MemberName').val($(this).find('span').eq(1).text())
        $('#PQ_YrBizStart').val($(this).find('span').eq(2).text())
        $('#PQ_BusinessIndustry').val($(this).find('span').eq(3).text())

        $dialogW.dialog("destroy");
    });

}
原文地址:https://www.cnblogs.com/wancy86/p/modal_window.html