ShowModalDialog and ShowModelessDialog use experience
1. What is the difference between SHOWMODALDIALOG and ShowModelessDialog?
ShowModalDialog: The input focus will always be kept after being opened. Users cannot switch to the main window unless the dialog is turned off. Similar to the operation of Alert.
SHOWMODELESSDIALOG: After being opened, the user can randomly switch the input focus. There is no impact on the main window (most is blocked, and it is: p)
Second, how can I make the SHOWMODALDIALOG and SHOWMODELESSDIALOG's super connection not pop up a new window?
Plus
Third, how do you only refresh the contents of ShowModalDialog and ShowModelessDialog?
In ShowModalDialog and ShowModelessDialog, you cannot press F5 to refresh, and you can't pop up menu. This can only rely on JavaScript, the following is related code:
Replace FileName.htm with the name of the web page and put it in your open page, press F5 to refresh, pay attention, this is to cooperate with
Fourth, how to turn off the window opened with SHOWMODALDIALOG (or ShowModelessDialog) with JavaScript.
Also together with
5. ShowModalDialog and ShowModelessDialog Data Transmission Skills.
(Author: I originally wanted to use a question and answer form, but I can't ask how to ask this, so I have this.)
This thing is more troublesome, I have changed several times, I don't have no way to understand (the language level is getting worse), I have to use an example.
example:
Now you need to read or set a variable var_name in a showmodaldialog (or showmodelessdialog)
General transmission mode:
Window.ShowModalDialog ("FileName.htm", Var_name)
// Pass the var_name variable
Read and set in ShowModalDialog (or ShowModelessDialog):
Alert (window.dialogarguments) // reads var_name variables
Window.dialogarguments = "ioiboy" // Sets var_name variables
This approach is satisfied, but when you want to operate the second variable virtue var_id at the same time? It is no longer possible to operate. This is the limitations of this transmission method.
The following is how I recommend it:
Window.ShowModalDialog ("FileName.htm", Window)
/ / No matter what variable to operate, only pass the Window object of the main window.
Read and set in ShowModalDialog (or ShowModelessDialog):
Alert (window.dialogarguments.var_name) // reads var_name variables
Window.Dialogarguments.var_name = "ioiboy" // Sets var_name variables
At the same time, I can also operate the var_id variable.
Alert (window.dialogarguments.var_id) // reads var_id variables
Window.Dialogarguments.var_id = "001" // Sets var_id variable
You can also operate any object of the main window, such as the element in the form object.
Window.Dialogarguments.form1.index1.value = "This is the value of the INDEX1 element"
Sixth, multiple ShowModelessDialog interoperability.
Because the light said is very hard, I will peek, I will use the code directly. If I don't understand, I will be directly letted (Oyiboy # 163.net (please send # @@) when using it..
The main role of the following code is to move a showmodelessDialog in a showmodelessdialog.
Site JS code for the main file.
VAR S1 = ShowModelessDialog ('' Control .htm '', Window, "Dialogtop: 1PX; Dialogleft: 1PX") // Open Control Window
Var S2 = ShowModelessDialog ('' About: Blank '', Window, "Dialogtop: 200px; Dialogleft: 300px") // Open the control window
Control the part of the .htm.
// Operation position data, because the location data of the window is "xxxpx" mode, so a special operation function is required.
Function countnumber (a_strnumber, a_strwhatdo)
{
A_STRNUMBER = a_strnumber.replace ('PX', '' ')
A_strnumber- = 0
Switch (a_strwhatdo)
{
Case "-": a_strnumber- = 10; Break;
Case " ": A_STRNUMBER = 10; BREAK;
}
Return A_StrNumber "PX"
}
script>
The above key parts are:
Window Named: Var S1 = ShowModelessDialog ('' Control .htm '', Window, "Dialogtop: 1px; Dialogleft: 1px")
Variable access method: window.dialogarguments.s2.dialogtop
This example is just the location operation function between the real ShowModelessDialog and ShowModelessDialog. Through this principle, the respective display pages, transfer variables, and data are controlled between ShowModelessDialog. It depends on everyone's play.