1

需要帮忙!我正在尝试在 onclick 事件后在模式窗口中打开 MWO 表单 (../forms/mwo.php)。当我单击按钮时,我什么都没有……甚至没有错误。

<a  id="newMWO" name="newMWO"  data-role="button" data-inline="true" target="_blank" onclick=getWOCnt()>
    New Work Order
</a>

<div id="mwoForm" title="MWO Form"></div>


$(function ()
            {               
                $(".newMWO").on('click', (function (event)
                {
                    event.preventDefault();

                    var loadVars=(encodeURI("../forms/MWO.php?a=<?php echo $_REQUEST['a']?>"));
                    var dialogName= $("#mwoForm").load(loadLVars);

                    $(dialogName).dialog({
                        autoOpen: false,
                        resizable: true,
                        modal: true,
                        bigframe: true,
                        height: 600,
                        width: 1000,
                        overflow: scroll,
                        resizable: true,
                        title: "MWO New Work Order"
                    });

                    dialogName.dialog('open');
                    return false;                                
                }));
            });
4

2 回答 2

1

使用#代替.您的anchor tag selector

喜欢$("#newMWO")代替$(".newMWO")

或添加class到您的anchor tag

<a  id="newMWO" name="newMWO" class="newMWO" data-role="button" 
     data-inline="true" target="_blank" onclick=getWOCnt()>
    New Work Order
</a>
于 2013-08-05T12:25:05.917 回答
0

你的选择器$(".newMWO")是错误的,应该是$("#newMWO")newMWO不是类属性值,是元素的id,所以需要用id-selector代替class-selector

$(function() {
    $(".newMWO").on('click', function(event) {
        event.preventDefault();

        var loadVars = (encodeURI("../forms/MWO.php?a=<?php echo $_REQUEST['a']?>"));
        var dialogName = $("#mwoForm").load(loadLVars);

        $(dialogName).dialog({
            autoOpen : false,
            resizable : true,
            modal : true,
            bigframe : true,
            height : 600,
            width : 1000,
            overflow : scroll,
            resizable : true,
            title : "MWO New Work Order"
        });

        dialogName.dialog('open');
        return false;
    });
});
于 2013-08-05T12:23:11.713 回答