473,839 Members | 1,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there any way to create a modal dialog in the html


Is there any way to create a modal dialog in the html, which should work
in both ie and netscape.
the one window.showmoda ldialog works well in ie, but not in netscape

i found a way to keep the window to setfocus like this

<script>
function SetFocusOnMe () {
this.SetFocus ();
setTimeout("Set FocusOnMe()", 50);
}

</script>

</head>

<body onLoad="javascr ipt:setTimeout( 'SetFocusOnMe() ', 50)">

but this gives javascript error

with regards
Balaji
Jul 23 '05 #1
3 1497
Balaji M wrote:

Is there any way to create a modal dialog in the html, which should work
in both ie and netscape.
the one window.showmoda ldialog works well in ie, but not in netscape

i found a way to keep the window to setfocus like this

<script>
function SetFocusOnMe () {
this.SetFocus ();
If you do this in Firefox, you get a message saying:

Error: this.SetFocus is not a function
Source File:
...
Line: 8

which is pretty self explanatory - SetFocus is not defined
anywhere as a JavaScript function.
setTimeout("Set FocusOnMe()", 50);
}

</script>

</head>

<body onLoad="javascr ipt:setTimeout( 'SetFocusOnMe() ', 50)">
No need for "javascript :".

So you call setTimeout every 50 ms from here, then again every
50ms from inside the function - cool.

but this gives javascript error


Even if it didn't, and it's trivial to fix, what's the point?
The user can simply close your "modal" window. Or if they have
Firefox (and maybe a number of other browsers), prevent you from
setting focus on it at all.

And if they have scripting disabled, your narcissistic 'dialog'
will not be able to be an attention hog at all. What purpose
does a modal dialog have in the context of a web browser?
--
Fred.
Jul 23 '05 #2
Fred Oz wrote:
Balaji M wrote:


<--snip-->
setTimeout("Set FocusOnMe()", 50);
}

</script>

</head>

<body onLoad="javascr ipt:setTimeout( 'SetFocusOnMe() ', 50)">

No need for "javascript :".

So you call setTimeout every 50 ms from here, then again every
50ms from inside the function - cool.


No. The onload calls it once, then the function calls itself to invoke
after 50 millliseconds. setTimeout only makes one call, setInterval
makes repeated calls (which is what I think you were thinking about
instead of setTimeout).

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #3
Randy Webb wrote:
[...]
No. The onload calls it once, then the function calls itself to invoke
after 50 millliseconds. setTimeout only makes one call, setInterval
makes repeated calls (which is what I think you were thinking about
instead of setTimeout).


Ah yes, post in haste, repent at leisure...

--
Fred
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6737
by: Gilles T. | last post by:
Hi, How I can refresh a modal dialog in asp.net? I open a modal dialog in first with a dropdownlist. To add a element in my dropdownlist (table), I open a second modal dialog to ask element and save. When I return in my first modal dialog, dropdownlist is not refreshed. I don't know how to refresh my first modal dialog to view my new element in the dropdownlist. Thanks to help me with this problem!
2
11086
by: Joe | last post by:
Is there a way to enable scrolling in a modal dialog box even if the call to open the modal has "scroll:no"? I am looking to dynamically size the modal dialog box for starters and if the modal is greater than 400px in height, I want turn on the scroll bars otherwise I don't want to turn them off. CODE IN MY PARENT WINDOW..... function modal() { window.showModalDialog("modal.htm", "docForm",
3
6656
by: Gretjns | last post by:
I'm trying to figure out this script doesn't display any text in the child window and why I'm getting the null or not an object error. It's taken directly from the Javascript and DHTML cookbook (not listed in the book errata on o'reilly website). Initially I get an error "window.dialogArguments.yourName" is null or not an object. Then I fill out the field on the form, press the button and the child window does display but there is no...
3
4369
by: tungchau81 | last post by:
Hi, A Modal Dialog does not allow us to highlight the text content inside <DIV> tag unless I use a <textarea> tag to display that text content. However, the situation of my software makes it impossible to use <textarea> and Modeless dialog. I am really stuck!!! Is there any trick to make <DIV> or <SPAN>'s content be selectable in a Modal dialog? Thanks in advance,
2
4941
by: Ricky K. Rasmussen | last post by:
Hi NG, We have a rather large ASP.NET application that uses popups to display various dialogs to the user. In our work we've come over a rather annoying "bug": If we open a modal dialog using the javascript command window.showModalDialog() we loose the current Session if a new window is opend from within the modal one (using the window.open() method). The "funny" thing is that this only occurs if another instance of IE has been
10
2760
by: Guadala Harry | last post by:
I have a modal dialog that currently does all of the following except item 4. 1. lets users select a graphic from a list of thumbnails (and when selected, displays the full-size image in a preview DIV) 2. when users close the dialog, the application receives the URL to the selected graphic. 3. the modal dialog lets the users upload a new graphic if the dialog does not present them with one they are already happy with. 4. upon uploading...
3
2256
by: mccoyn | last post by:
When I have a long process to run I can create a new thread to run it and create a modal dialog on my GUI thread. The modal dialog prevents any messages (like button clicks) from working on my main Form. It also provides a message loop, which allows paint messages and calls to the Control::Invoke function to run. I can use these to invalidate an area and update it with intermediate results of my process. When the process is done, I...
1
49896
by: mikeh3275 | last post by:
I'm new to developing in jQuery, so I'm probably doing this wrong. I'm loading a form into a modal dialog box and I'm trying to assign a click event to the button in the form, but I can't seem to get anything to happen. Below is the code. Thanks in advance. jQuery: jQuery(document).ready(function() { jQuery("a").click(function() { jQuery("#dialog").dialog({ modal: true,
2
3523
by: diogenes | last post by:
I have created many shortcut/popup (aka context, or right-click) menus for my application - instead of toolbars or standard drop-down menus. Within my custom menu, I am using =ShowMainMenu("item") in the On Action event where ShowMainMenu is a public function in frmMain, and "item" is a string mapping to a button click event. (error trapping omitted) Public Function ShowMainMenu(strItem As String) As Boolean
0
9855
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10909
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10588
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10650
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10295
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7019
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5682
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.