模态弹出窗口不在IE浏览器中运行

时间:2010-12-31 04:55:28

标签: javascript asp.net ajax

我写了一个模态弹出窗口。我使用ajax模式弹出扩展程序,但它不在IE中运行。为什么呢?

<script type="text/javascript">
            //<![CDATA[
            var _eventButtonElement = null;

            function OkClick() {
                if (_eventButtonElement) {
                    _eventButtonElement.click();
                }
            }

            function CancelClick() {
                _eventButtonElement = null;
                return true;
            }

            function showModalPopupViaClient(Icon, Title, Message) {
                if (_eventButtonElement) {
                    return CancelClick();
                }

                _eventButtonElement = window.event.srcElement;

                var modalPopupBehaviorVar = $find('programmaticModalPopupBehavior');
                var modalPopupTitleVar = $get('modalPopupTitle');
                var modalPopupIconVar = $get('modalPopupIcon');
                var modalPopupMessageVar = $get('modalPopupMessage');
                var CancelButtonContainerVar = $get('CancelContainer');

                if (Icon == 'Information') {
                    modalPopupIconVar.src = 'App_Images/Test/Information.png';
                    CancelButtonContainerVar.style.display = 'none';
                } else if (Icon == 'Explanation') {
                    modalPopupIconVar.src = 'App_Images/Test/Exclamation.png';
                    CancelButtonContainerVar.style.display = 'none';
                } else if (Icon == 'Error') {
                    modalPopupIconVar.src = 'App_Images/Test/Error.png';
                    CancelButtonContainerVar.style.display = 'none';
                } else if (Icon == 'Question') {
                    modalPopupIconVar.src = 'App_Images/Test/Question.png';
                    CancelButtonContainerVar.style.display = '';
                }

                modalPopupTitleVar.innerHTML = Title;
                modalPopupMessageVar.innerHTML = Message;
                modalPopupBehaviorVar.show();

                return false;
            }


            //]]>
        </script>

        <asp:Panel runat="server" ID="programmaticPopup" style="width:350px;padding:10px" CssClass="modalPopup">
            <asp:Panel runat="Server" ID="programmaticPopupDragHandle" Style="cursor: move;background-color:#ddd;border:solid 1px gray;color:#000;text-align:left;padding-left:5px">
                <img id="modalPopupIcon" alt="" src="" class="" />&nbsp;&nbsp;<span id="modalPopupTitle" />
            </asp:Panel>

            <p class="smalltext" id="modalPopupMessage" />

            <div style="text-align:center">
                <span class="button" >
                    <asp:Button ID="OkButton" CausesValidation="false" OnClientClick="return false;" runat="server" Text="Ok" />
                </span>
                <span class="button" id="CancelContainer">
                    <asp:Button ID="CancelButton" CausesValidation="false" OnClientClick="return false;" runat="server" Text="Cancel" />
                </span>
            </div>
         </asp:Panel>
        <asp:ModalPopupExtender runat="server" ID="programmaticModalPopup"
                BehaviorID="programmaticModalPopupBehavior"
                TargetControlID="hiddenTargetControlForModalPopup"
                PopupControlID="programmaticPopup"
                OkControlID="OkButton"
                OnOkScript="OkClick();"
                OnCancelScript="CancelClick();"
                CancelControlID="CancelButton"
                BackgroundCssClass="modalBackground"
                DropShadow="True" 
                PopupDragHandleControlID="programmaticPopupDragHandle"
                RepositionMode="RepositionOnWindowResizeAndScroll"/>
        <asp:Button runat="server" CausesValidation="false" ID="hiddenTargetControlForModalPopup" style="display:none"/>

        <asp:Button ID="Button1" CausesValidation="false" runat="server" OnClientClick="return showModalPopupViaClient('Question','Question','Are you sure...?');" Text="Submit" />

0 个答案:

没有答案