javascript window returnValue

returnValue NN n/a IE 4(Win)/5(Mac) DOM n/a  
  Read/Write  

A value to be returned to the main window when an IE dialog window (generated by  showModalDialog( ) method only) closes. The value assigned to this property in a script running in the dialog window becomes the value returned by the showModalDialog( ) method in the main window. For example, the document in the modal dialog window may have a statement that sets the returnValue property with information from the dialog:

window.returnValue = window.document.forms[0].userName.value;

The dialog is created in the main document with a statement like the following:

var userName = showModalDialog("userNamePrompt.html");

Whatever value is assigned to returnValue in the dialog is then assigned to the userName variable when the dialog box closes and script execution continues.

 
Value

Any scriptable data type.

 
Default

None.


  • #1
    2010-01-28
    [Quote]
    Awesome, was looking for this bit of code. pity it's only for IE. thanks though!
  • Nico
    #2
    2010-03-24
    [Quote]
    Hi, is there any way of achieve this with other browsers ? chrome, ff at least ?
    Regards
  • javascript manual
    #3
    2010-03-24
    [Quote]
    [Nico: Hi, is there any way of achieve this with other browsers ? chrome, ff at least ?Regards]
    NN==FF. And things which don't work on FF don't work on Chrome.
  • #4
    2010-03-28
    [Quote]
    Exactly what I was looking for, thanks!
  • Guest #475
    #5
    2011-12-20
    [Quote]
    function closeWindow(value){
    window.returnValue=value;
    alert(window.returnValue);
    window.close();

    }
    alerting the value but always return null value in the main window
    I am using FF/IE
    Can any one help me
    Thanks in advance..
  • Guest #921
    #6
    2011-12-20
    [Quote]
    Was the window create by showModalDialog?
Jerry
Nico
javascript manual
James
Guest #475
Guest #921

2216,Nickname,Homepage or email,Comments here,Add comment