Alternate for Showmodaldialog in mozilla firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TechnoAtif
    New Member
    • Sep 2007
    • 63

    Alternate for Showmodaldialog in mozilla firefox

    Hi all.
    I have used showmodaldialog for a popup window. it works fine in IE but shows :Error: showModalDialog is not defined.
    I have gone through many forums but haven't got satisfactory solution.

    Moreover i dont want the popupwindow to be closed manually .It gets closed automatically as the time fixed for its display gets over.

    This functionality is working fine in IE but if someone could help me out to run it in Mozilla and other browsers,it would be great.

    Below is my code:

    [HTML]function getUpload(sForm ){
    {
    var synclose=null;

    while(synclose= =null)
    {
    var sURL = sForm;
    var rst = showModalDialog (sURL, '', 'dialogWidth:60 0px; toolbar:0; dialogHeight:30 0px; status:0; resizable=0;');
    };
    }
    }
    </script>
    </head><?php
    $mode=1;
    if($mode==1)
    {
    ?>
    <body onLoad="getUplo ad('syncpop.php ')"> </body>

    <?php
    }
    ?></html>
    [/HTML]

    //Here is the syncpop.php page

    [HTML]
    <html>
    <head>
    <META HTTP-EQUIV=REFRESH CONTENT=2>
    <body>
    <? $mode=1;
    if ($mode==1){?>
    <script language="javas cript">
    document.write( "Synchonizi ng, please wait...");
    </script>
    <? }
    if($mode==0){?>
    <script type="text/javascript">
    alert('Last Synchronizaton completed successfully');
    window.returnVa lue = "Success!!" ;
    window.close();
    </script>
    <? }?></body>
    </html>[/HTML]

    The code involves a little bit of php but it hardly makes difference..i want the javascript function only that could solve my above mentioned purpose.

    Thanks and Regards
    TechnoAtif
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    for other browsers you have to create a custom DHTML-(div)-dialog, that you could use for IE too. developing a page for IE first and then trying to adapt it to standards-compliant browsers is much more difficult then the other way round ...

    kind regards

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      showModalDialog is now supported in Firefox 3, but for older versions and other browsers you will need to create your own as gits mentioned.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        hmmm ... it seems that safari 3.1 supports it too ...

        kind regards

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          So that leaves Opera from the major browsers.

          Comment

          • TechnoAtif
            New Member
            • Sep 2007
            • 63

            #6
            [HTML]<title>Popup WebPage</title>
            <script language="javas cript">
            function makePopup(url, width, height, overflow)
            {
            if (width > 640) { width = 640; }
            if (height > 480) { height = 480; }
            if (overflow == '' || !/^(scroll|resize |both)$/.test(overflow) )
            {
            overflow = 'both';
            }
            var win = window.open(url , '',
            'width=' + width + ',height=' + height
            + ',scrollbars=' + (/^(scroll|both)$/.test(overflow) ?
            'yes' : 'no')
            + ',resizable=' + (/^(resize|both)$/.test(overflow) ?
            'yes' : 'no')
            + ',status=yes,to olbar=no,menuba r=no,location=n o'
            );
            return win;
            }


            </script>
            <?
            $mode=1;
            if($mode==1){?>
            <html><body onLoad="makePop up(syncpop.php' , 480, 240, 'resize')" ></body></html>
            <? } ?>

            //syncpop.php

            window.onbefore unload = function (evt) {
            var message = '';
            if (typeof evt == '') {
            evt = window.event;
            }
            if (evt) {
            evt.returnValue = message;
            }
            return message;
            }


            [/HTML]






            this code works but not completely...an y suggestions??

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              What do you mean by "not completely"? What doesn't work?

              Comment

              • TechnoAtif
                New Member
                • Sep 2007
                • 63

                #8
                I want the popup window not to get closed ,even on click of the close option untill the time fixed for its display does not gets over.
                Using Window.onbefore unload prompts a dialog box and the window can be closed on clicking the ok button . I dont want it to close .
                Any suggestions?

                Comment

                • gits
                  Recognized Expert Moderator Expert
                  • May 2007
                  • 5388

                  #9
                  then your best bet is certainly a custom DHTML-popup ... since you even should use it to support all! browsers ... i guess you cannot avoid closing a 'real' window ...

                  kind regards

                  Comment

                  • TechnoAtif
                    New Member
                    • Sep 2007
                    • 63

                    #10
                    plz dont tell me that their is no solution to this issue. I have to do it for th client

                    plz find some solution.

                    Comment

                    • gits
                      Recognized Expert Moderator Expert
                      • May 2007
                      • 5388

                      #11
                      the DHTML-popup IS a solution ... and certainly the best one!

                      Comment

                      • TechnoAtif
                        New Member
                        • Sep 2007
                        • 63

                        #12
                        Ok i'll try it. lets hope for the best. If you have done some work on it kindly share with me. Alongside i'm trying it on my side too .

                        Thanks

                        Comment

                        • gits
                          Recognized Expert Moderator Expert
                          • May 2007
                          • 5388

                          #13
                          you just have to create a div onclick at whatever you want to open it. use dom-methods like document.create Element('div'); for example. then apply any apropriate css (don't forget the z-index!) to it and append needed elements, like an iframe to load a page or whatever. set a timeout when you need to have it closed after some time ...

                          another possibility is to create it staticly and set its visibility to hidden, and onclick of the element you need, just toggle its visibility-property.

                          kind regards

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #14
                            If you want nice-looking popup-divs that have already been written, try GreyBox, ThickBox, SlightlyThicker Box, ShadowBox, iBox or other LightBox clones that support displaying of HTML and not just images as the original LightBox does.

                            Comment

                            Working...