弹出式对话框
   
  Javascript有许多内建的方法来产生对话框,如:window.alert(), window.confirm(),window.prompt().等。 然而IE提供更多的方法支持对话框。如:  showModalDialog() (IE 4+ 支持)
  showModelessDialog() (IE 5+ 支持) 语法如下:  vReturnValue = window.showModalDialog(sURL[, vArguments][, sFeatures]);
  vReturnValue = window.showModelessDialog(sURL[, vArguments][, sFeatures]); 
其中:sURL 是新窗口调入的 URL ;vArguments 是显示文档时可供使用的变量,它可以传递任何类型的数值,包括数组,对话框可以利用window对象的dialogArguments属性提取这些参数。当一个新窗口打开时,对话框便赋予本窗口dialogArguments属性,dialogArguments含有被传递来的值。
例如:  window.showModalDialog("exam1.htm", window);   当我们用showModelessDialog() 打开窗口时,不必用 window.close();去关闭它,当以 Modeless方式[IE5]打开时, 打开对话框的窗口仍可以进行其他的操作,即对话框不总是最上面的焦点,当打开它的窗口URL改变时,它自动关闭。而 Model[IE4]方式的对话框始终有焦点(焦点不可移走,直到它关闭)。Model对话框和打开它的窗口相联系,因此我们打开另外的窗口时,他们的链接关系依然保存,并且隐藏在活动窗口的下面。 
sFeatures 是描述对话框外在样子的字符串,取值如下:
  dialogHeight 对话框高度,不小于100px,IE4中dialogHeight 和 dialogWidth 默认的单位是em,而IE5中是px,为方便其见,在定义modal方式的对话框时,用px做单位。
  dialogWidth: 对话框宽度。
  dialogLeft: 距离桌面左的距离。
  dialogTop: 离桌面上的距离。
  center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。 
  help: {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes。
  resizable: {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no。
  status: {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]或no[Modal]。  使用之前, 必须进行浏览器可用性检测,看是否支持这些方法:  if (window.showModalDialog) {
  ..
  } 
  if (window.showModelessDialog) {
  ...
  }
  或者
  if (window.showModalDialog) {
  win = window.showModalDialog("mydialog.html", ...);
  } else {
  win = window.open("mydialog.html", ...);
  } 
 

解决方案 »

  1.   

    showModalDialog--------------------------------------------------------------------------------DescriptionCreates a dialog box and displays in it the HTML document given by URL. The dialog box is a special window that is modal, meaning it retains the input focus until the user closes it. Syntax
    variant = object.showModalDialog(sURL [, vArguments [, sFeatures]])Parameter Description 
    sURL  String specifying the URL of the document to load and display. While an empty string is accepted (""), it should be noted that this is useless since once a modal dialog has been opened, it cannot be accessed by the page that opened it. 
    vArguments  Optional. Variant specifying the arguments to use when displaying the document. This parameter can be used to pass a value of any type including an array of values. The dialog can extract the values passed by the caller from the dialogArguments property of the window object.  
    sFeatures  Optional. String specifying the window ornaments for the dialog box. It can be a combination of the following values. Syntax  Description  
    dialogWidth:number  Sets the width of the dialog window. 
    dialogHeight:number  Sets the height of the dialog window. 
    dialogTop:number  Sets the top position of the dialog window relative to the upper-left corner of the desktop. 
    dialogLeft:number  Sets the left position of the dialog window relative to the upper-left corner of the desktop. 
    center:{yes | no | 1 | 0 }  Specifies whether to center the dialog window within the desktop. Default is yes. 
     Return ValueReturns a number, string, or other value. This is equal to the value of the returnValue property as set by the document given by URL. ResThe default font settings should be set in the same way CSS attributes are set; for example, "font:3;font-size:4". To define multiple font values, use multiple font attributes. When dialogLeft and/or dialogTop is specified, the feature center is overridden, even though the default for center is yes.Applies Towindow 
    msdn里面很详细