J
jimmyfishbean
Hi,
I have surfed the net for some time now trying to get to the bottom of
a problem I face. I have a parent window that is a frameset (only 1
frame). From a form button in this window, I open up a child pop up
window containing a frameset (also contains only one frame). The child
window makes the user selects a value. This value is to be returned to
the form in the parent window (and the child window then closes).
I can get this to work when not using frames, but cannot get it to work
with frames.
The code behind the parent window is:
....
....
<script
language="javascript">rsenableremotescripting("/includes/js/");</script>
function showlist(){
slist = window.open("lookup.asp", "list", "width=300,height=410");
}
function remlink() {
if (window.slist && window.slist.open && !window.slist.closed)
window.slist.opener = null;
}
</script>
</head>
<body onUnload="remlink()">
<form name="stockform">enter your favorite tech stock:
<input type="text" name="stockbox" size="10" value="">
<input type="button" value="list" onclick="showlist()">
</form>
....
....
The child window opens without a problem. The code behind it is:
<script language="javascript">
function pick(symbol) {
alert("in pick function");
if (window.opener && !window.opener.closed)
alert("still in pick");
window.opener.document.stockForm.stockBox.value = symbol;
//window.opener.parent.start.document.stockForm.stockBox.value =
symbol;
//top.opener.document.stockForm.stockBox.value = symbol;
window.close();
}
</script>
<table border="1" cellspacing="0" cellpadding="5">
<tr bgcolor="#cccccc"><td><b>nyse</b></td><td><b>nasdaq</b></td></tr>
<tr><td><a href="javascriptick('aol')">aol</a></td>
<td><a href="javascriptick('csco')">csco</a></td></tr>
</table>
As you can see, when the user clicks on a link in the child window,
function pick() gets invoked. The first alert message "in pick
function" gets called. However, the code gets no further (it doees not
get passed the next line: if (window.opener && !window.opener.closed)),
therefore the second alert is never called.
I have tried several variations of calling/setting the form field in
the parent window (some are commented out above), but to no success.
Both browser windows contain a frameset that has only one frame:
<frameset framespacing="0" border="false" frameborder="0"
rows="100%,*">
<frame name="start" src="/home/start.asp?dest=" scrolling="yes"
noresize marginwidth="0" marginheight="0">
</frameset>
Please could someone tell me if it is possible to do what I am trying
to do (please say yes!!) and if someone could point me in the right
direction that would be much appreciated. Thanks.
Jimmy
I have surfed the net for some time now trying to get to the bottom of
a problem I face. I have a parent window that is a frameset (only 1
frame). From a form button in this window, I open up a child pop up
window containing a frameset (also contains only one frame). The child
window makes the user selects a value. This value is to be returned to
the form in the parent window (and the child window then closes).
I can get this to work when not using frames, but cannot get it to work
with frames.
The code behind the parent window is:
....
....
<script
language="javascript">rsenableremotescripting("/includes/js/");</script>
function showlist(){
slist = window.open("lookup.asp", "list", "width=300,height=410");
}
function remlink() {
if (window.slist && window.slist.open && !window.slist.closed)
window.slist.opener = null;
}
</script>
</head>
<body onUnload="remlink()">
<form name="stockform">enter your favorite tech stock:
<input type="text" name="stockbox" size="10" value="">
<input type="button" value="list" onclick="showlist()">
</form>
....
....
The child window opens without a problem. The code behind it is:
<script language="javascript">
function pick(symbol) {
alert("in pick function");
if (window.opener && !window.opener.closed)
alert("still in pick");
window.opener.document.stockForm.stockBox.value = symbol;
//window.opener.parent.start.document.stockForm.stockBox.value =
symbol;
//top.opener.document.stockForm.stockBox.value = symbol;
window.close();
}
</script>
<table border="1" cellspacing="0" cellpadding="5">
<tr bgcolor="#cccccc"><td><b>nyse</b></td><td><b>nasdaq</b></td></tr>
<tr><td><a href="javascriptick('aol')">aol</a></td>
<td><a href="javascriptick('csco')">csco</a></td></tr>
</table>
As you can see, when the user clicks on a link in the child window,
function pick() gets invoked. The first alert message "in pick
function" gets called. However, the code gets no further (it doees not
get passed the next line: if (window.opener && !window.opener.closed)),
therefore the second alert is never called.
I have tried several variations of calling/setting the form field in
the parent window (some are commented out above), but to no success.
Both browser windows contain a frameset that has only one frame:
<frameset framespacing="0" border="false" frameborder="0"
rows="100%,*">
<frame name="start" src="/home/start.asp?dest=" scrolling="yes"
noresize marginwidth="0" marginheight="0">
</frameset>
Please could someone tell me if it is possible to do what I am trying
to do (please say yes!!) and if someone could point me in the right
direction that would be much appreciated. Thanks.
Jimmy