Is there anyway I can pass a javascript variable to a Modal?
A:
Option 1:
Try this.. while opening the modaldialog send the window as the parameter
showModalDialog(url,window,params);
and in the modal window
var parWin = window.dialogArguments;
now parWin contains your parent window object.
From here you can now access all data from your parent, be it variables or methods.
Option 2:
<SCRIPT LANGUAGE="JavaScript">
<!--
var a = new Array;
a[0]="first";
a[1]="second";
a[2]="third";
// -->
</SCRIPT>
And we pass the array a to the dialog box:
window.showModelessDialog('7b.html',a);
The callee 7b.html includes the following script:
<SCRIPT LANGUAGE="JavaScript">
<!--
a = dialogArguments;
a[0] = "fourth";
// -->
</SCRIPT>
Some other reading on this:
http://www.webreference.com/js/column90/
Ryan Ternier
2010-09-24 20:49:24
One Correction: It is dialogArguments not dialogueArguments, but thanks for the great answer.
Scott
2010-09-24 21:04:29
Sorry. I can't help it if the makers of JavaScript didn't spell things properly :) Edited for clarity.
Ryan Ternier
2010-09-24 21:06:43