jquery 在 coldfusion 中 window 不是 运行 在加载中

jquery in coldfusion window not running on load

我遇到的问题是我有一个在页面加载时调用的 jQuery 函数。在我的页面上,我有一个 cfgrid 打开了一个 coldfusion window,但是 jQuery 不会在那个 window 上工作。我已经尝试将 jQuery 放在两个页面上,但我根本无法让它工作。我知道 jQuery 没问题,我已经通过浏览器 运行 它并且按预期工作。它只是不会加载到新的 window.

我的想法是我的网格有名称,一旦单击,它会打开一个带有日期列表的 cfwindow。单击日期后,它将在 div infodiv 中显示正确日期的信息。 $(document).ready(function(){} 在新的 window 中不起作用。

jscript/jquery

$(document).ready(function(){
    $('.infodiv').hide();

    $('#record').change(function(){
         var state = $(this).val();
         if(!state) $('infodiv').hide();

         var div= $('#' + state );
         div.removeClass('infodiv');
         $('.infodiv').hide();
         div.addClass('infodiv');

         if ( !div.is(':visible') ) div.fadeIn(500);
    });
});

function selectProfile(button,event){
    var grid = ColdFusion.Grid.getGridObject("myGrid");
    var record = grid.getSelections();
    var key = record[0].data.REF
    var config = new Object();
    // config style details
    config.bodyStyle='font-size:20px; font-family: Arial; color: #ff0000;';
    config.headerStyle ='font-family: Arial; background-color: red; color: white;'; ColdFusion.Window.create("selectProfileWindow","Records","viewrecords.cfm?CFGRIDKEY="+key , config);
    ColdFusion.Window.onHide("selectProfileWindow",cleanup);
    document.getElementById(ColdFusion.Window.getWindowObject("selectProfileWindow").header.id).className = "windowHdr";

}

这是在网格上弹出的 ColdFusion Window viewrecords.cfm(不包括)select,应该 运行 jQuery 和 hide/show divs 根据我的 record select 框

<td>
    <cfselect name="record" id="record">
        <cfloop query="grabRecords">
                <option value="#sequence#">
                #startDate# - #endDate#
                </option>
        </cfloop>
    </cfselect>
</td>
<td>
    <cfloop query="grabRecords">
                <div id="#sequence#" class="infodiv">
                    #ref# - #Name#
                </div>
    </cfloop>
</td>

编辑:使用过时的 coldfusion 8

对于那些臭名昭著的 CF ajax 东西,您需要遵循他们的做事方式。查看 https://wikidocs.adobe.com/wiki/display/coldfusionen/AjaxOnLoad

上的 AjaxOnLoad()