I want to use a pop-up dialog for my intranet, but I'm missing
something that keeps me from getting along with NS's browsers right
now.
I get an error to the effect of "opener.formNam e has no properties"
The following JS is its own file included in caller.html and
callee.html with this syntax <SCRIPT language="JavaS cript"
src="pops.js"></SCRIPT>
It works in current IE's on multiple platforms and in Apple's Safari.
Any ideas about how I might work it for NS?
Thanks,
Mark
// <pops.js>
var DEBUGGING=false ;
var myTarget=null;
function popUp(argURL, argOBJ, argH, argW) {
/* Useage example from caller.html:
<FORM name="stockForm ">
<INPUT name="txtA" type="text" id="txtA" value="" size="10" />
<INPUT name="btnA" type="button" id="btnA"
onClick="popUp( 'callee.html', this)" value="." /><BR />
</FORM>
*/
try {
// default to 300x300, otherwise use options offered
argH=(!argH || argH==0) ? 300 : argH;
argW=(!argW || argW==0) ? 300 : argW;
// establish error message in case something goes wrong
var Err = new Error();
Err.message="mc s.js popUp(" + argURL + ", " + argOBJ.name + ", " +
argH + ", " + argW + ") error:\n\nmyTar get not established or window
not opened";
// set aside the name of the object which will be receiving the
value chosen in the popUp window
// presumes usage from naming as used above txtA and btnA
myTarget=argOBJ .form.name+'.'+ 'txt'+argOBJ.na me.substr(3,
argOBJ.name.len gth-3);
if (DEBUGGING) alert('myTarget ='+myTarget);
// open the popUp
listWin=window. open(argURL, 'list', 'height='+argH+ ',
width='+argW+', left =100, top=100, location=no, menubar=no,
resizable=yes, scrollbars=yes, status=no, toolbar=no');
// complain if it didn't work
if (myTarget==null || !listWin) throw(Err);
}
catch (Err)
{ alert(Err.messa ge); }
}
function popDown(argVAL) {
/* Useage example from callee.html:
<A href="#" onClick="popDow n('AMZN')">AMZN </A>
*/
try {
// establish error message in case something goes wrong
var Err = new Error();
Err.message="mc s.js popDown("+argVA L+") error:\n\nmyTar get not set";
var evalMe="opener. "+opener.myTarg et+".value="+"' "+argVAL+"' ";
if (DEBUGGING) alert('evalMe=' +evalMe);
eval(evalMe);
// if myTarget != val then complain
if (eval("opener." +opener.myTarge t+".value!="+"' "+argVAL+"' "))
throw(Err);
else window.close();
}
catch (Err)
{ alert(Err.messa ge); }
}
// </pops.js>
something that keeps me from getting along with NS's browsers right
now.
I get an error to the effect of "opener.formNam e has no properties"
The following JS is its own file included in caller.html and
callee.html with this syntax <SCRIPT language="JavaS cript"
src="pops.js"></SCRIPT>
It works in current IE's on multiple platforms and in Apple's Safari.
Any ideas about how I might work it for NS?
Thanks,
Mark
// <pops.js>
var DEBUGGING=false ;
var myTarget=null;
function popUp(argURL, argOBJ, argH, argW) {
/* Useage example from caller.html:
<FORM name="stockForm ">
<INPUT name="txtA" type="text" id="txtA" value="" size="10" />
<INPUT name="btnA" type="button" id="btnA"
onClick="popUp( 'callee.html', this)" value="." /><BR />
</FORM>
*/
try {
// default to 300x300, otherwise use options offered
argH=(!argH || argH==0) ? 300 : argH;
argW=(!argW || argW==0) ? 300 : argW;
// establish error message in case something goes wrong
var Err = new Error();
Err.message="mc s.js popUp(" + argURL + ", " + argOBJ.name + ", " +
argH + ", " + argW + ") error:\n\nmyTar get not established or window
not opened";
// set aside the name of the object which will be receiving the
value chosen in the popUp window
// presumes usage from naming as used above txtA and btnA
myTarget=argOBJ .form.name+'.'+ 'txt'+argOBJ.na me.substr(3,
argOBJ.name.len gth-3);
if (DEBUGGING) alert('myTarget ='+myTarget);
// open the popUp
listWin=window. open(argURL, 'list', 'height='+argH+ ',
width='+argW+', left =100, top=100, location=no, menubar=no,
resizable=yes, scrollbars=yes, status=no, toolbar=no');
// complain if it didn't work
if (myTarget==null || !listWin) throw(Err);
}
catch (Err)
{ alert(Err.messa ge); }
}
function popDown(argVAL) {
/* Useage example from callee.html:
<A href="#" onClick="popDow n('AMZN')">AMZN </A>
*/
try {
// establish error message in case something goes wrong
var Err = new Error();
Err.message="mc s.js popDown("+argVA L+") error:\n\nmyTar get not set";
var evalMe="opener. "+opener.myTarg et+".value="+"' "+argVAL+"' ";
if (DEBUGGING) alert('evalMe=' +evalMe);
eval(evalMe);
// if myTarget != val then complain
if (eval("opener." +opener.myTarge t+".value!="+"' "+argVAL+"' "))
throw(Err);
else window.close();
}
catch (Err)
{ alert(Err.messa ge); }
}
// </pops.js>
Comment