473,394 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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:600px; toolbar:0; dialogHeight:300px; status:0; resizable=0;');
};
}
}
</script>
</head><?php
$mode=1;
if($mode==1)
{
?>
<body onLoad="getUpload('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="javascript">
document.write("Synchonizing, please wait...");
</script>
<? }
if($mode==0){?>
<script type="text/javascript">
alert('Last Synchronizaton completed successfully');
window.returnValue = "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
Jul 1 '08 #1
13 11093
gits
5,390 Expert Mod 4TB
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
Jul 1 '08 #2
acoder
16,027 Expert Mod 8TB
showModalDialog is now supported in Firefox 3, but for older versions and other browsers you will need to create your own as gits mentioned.
Jul 1 '08 #3
gits
5,390 Expert Mod 4TB
hmmm ... it seems that safari 3.1 supports it too ...

kind regards
Jul 1 '08 #4
acoder
16,027 Expert Mod 8TB
So that leaves Opera from the major browsers.
Jul 1 '08 #5
[HTML]<title>Popup WebPage</title>
<script language="javascript">
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,toolbar=no,menubar=no,location=no'
);
return win;
}


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

//syncpop.php

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


[/HTML]






this code works but not completely...any suggestions??
Jul 1 '08 #6
acoder
16,027 Expert Mod 8TB
What do you mean by "not completely"? What doesn't work?
Jul 1 '08 #7
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.onbeforeunload prompts a dialog box and the window can be closed on clicking the ok button . I dont want it to close .
Any suggestions?
Jul 2 '08 #8
gits
5,390 Expert Mod 4TB
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
Jul 2 '08 #9
plz dont tell me that their is no solution to this issue. I have to do it for th client

plz find some solution.
Jul 2 '08 #10
gits
5,390 Expert Mod 4TB
the DHTML-popup IS a solution ... and certainly the best one!
Jul 2 '08 #11
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
Jul 2 '08 #12
gits
5,390 Expert Mod 4TB
you just have to create a div onclick at whatever you want to open it. use dom-methods like document.createElement('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
Jul 2 '08 #13
acoder
16,027 Expert Mod 8TB
If you want nice-looking popup-divs that have already been written, try GreyBox, ThickBox, SlightlyThickerBox, ShadowBox, iBox or other LightBox clones that support displaying of HTML and not just images as the original LightBox does.
Jul 2 '08 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Toby A Inkster | last post by:
www.authoring.stylesheets] For ages I have provided links to alternate stylesheets from my pages as per W3C recommendations: <link rel="stylesheet" href="baz" type="text/css" title="Baz"...
6
by: needin4mation | last post by:
I haven't used it in a while and thought I would check on it. Some say not to use ShowModalDialog (or at least they used to). But I just saw where Firefox has support for a similar type windows...
10
by: News | last post by:
I have a page up trying to learn how to ID a browser and other info. http://wyght.com/warren/testPos.html here is the code <script type = "text/javascript"> var space = ", "; var name...
3
by: johkar | last post by:
Just want a verification of logic. This seems to work for IE and Firefox, but I wonder if it would be a problematic test in any of the other latest browsers? Is the use of the "window" object...
9
by: Alex D. | last post by:
Hi, I have a frame in one of my pages that I use to show diferent pages each time. I am experiencing an weird behaviour in Mozilla and Firefox, when the frame's source is specified in the server...
8
by: Clément | last post by:
Hi! I am currently developping a user interface with Ajax/C#/.net. And I am facing a problem with Mozilla, and Firefox. I use the function innerHTML to load a Web UserControl into a div, this...
5
by: Faizmysore | last post by:
This code works good in IE, function multiuser() { document.frmOpenInteraction1.Create.disabled=true; document.frmOpenInteraction1.hidmultiuser.value="Yes"; var r =...
4
by: sarath chandran | last post by:
Hi all, can you tell me the replacement for window.showModalDialog in Mozilla. the code given below works well in IE but it doesn't work in Mozilla. Is there any replacement for...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.