A
ahmadtx
First, I really appreciate anyone's help in advance.
In short, I have a page that contains a form, which upon submission
I'd like to popup a windw that contains two frames. The form should
post to that 2nd frame ONLY.
I know how to popup a window, and post the form to it; but I can't
seem to post it to a frame of that window.
I'd share my code, but we're talking about a crap load of code here.
Nonetheless, here's a shot at it:
The main page has a form, which reads:
<form id="hs_form" name="hs_form" method="post" action="...some
URL ..." target="lowerFrame" onSubmit="if (!buttonClicked) return
false>
....
<input type=button value="Submit Search"
onClick="NewWindow('popupframe.shtml','myWin',1000,600,'no');
buttonClicked=true; setTimeout('document.hs_form.submit()',500)" />
The NewWindow function looks like this:
/* Cross-Browser Window Popup Script */
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition
+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
The popupframe.shtml has some serious crap about parsing the query
string. Still, here it is:
function getSearchAsArray() {
var minNav3 = (navigator.appName == "Netscape" &&
parseInt(navigator.appVersion) >= 3)
var minIE4 = (navigator.appName.indexOf("Microsoft") >= 0 &&
parseInt(navigator.appVersion) >= 4)
var minDOM = minNav3 || minIE4 // Baseline DOM required for this
function
var results = new Array()
if (minDOM) {
var input = unescape(location.search.substr(1))
if (input) {
var srchArray = input.split("&")
var tempArray = new Array()
for (i = 0; i < srchArray.length; i++) {
tempArray = srchArray.split("=")
results[tempArray[0]] = tempArray[1]
}
}
}
return results
}
function loadFrame(varName,fName) {
/*
varName is the "name" part of the name/value pair in the query-string/
URI
fName is the name of the frame passed.
*/
var url = "aboutus.shtml";
if (location.search) {
var srchArray = getSearchAsArray()
if (srchArray[varName]) {
var url = srchArray[varName]
//alert (url);
}
}
//alert(top.opener.document.forms[0].target);
parent.frames[fName].location = url;
}
The actual frameset of popupframe.shtml is:
<frameset rows="127,*" onLoad="loadFrame('content', 'lowerFrame')">
<frame src="topFrame.shtml" scrolling=no marginwidth=0
marginheight=0 name="upperFrame" id="upperFrame">
<frame src="javascript:' '" name="lowerFrame" id="lowerFrame">
</frameset>
Again, I'm trying to submit the search from the main page to the
popup's "lowerFrame" frame.
Oh yeah, topFrame.shtml is my banner page (kinda like Google's image
search results ... after you click on an image, of course).
BTW, the commented line that reads:
//alert(top.opener.document.forms[0].target);
returns a privacy/illegal action exception of some sort. Otherwise,
the intention was to change the target of the main page's form to be
the intended frame.
Again, any help would be greatly appreciated. After several hours on
a couple of days, I'm just too fried to see straight.
Thank you in advance.
In short, I have a page that contains a form, which upon submission
I'd like to popup a windw that contains two frames. The form should
post to that 2nd frame ONLY.
I know how to popup a window, and post the form to it; but I can't
seem to post it to a frame of that window.
I'd share my code, but we're talking about a crap load of code here.
Nonetheless, here's a shot at it:
The main page has a form, which reads:
<form id="hs_form" name="hs_form" method="post" action="...some
URL ..." target="lowerFrame" onSubmit="if (!buttonClicked) return
false>
....
<input type=button value="Submit Search"
onClick="NewWindow('popupframe.shtml','myWin',1000,600,'no');
buttonClicked=true; setTimeout('document.hs_form.submit()',500)" />
The NewWindow function looks like this:
/* Cross-Browser Window Popup Script */
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition
+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
The popupframe.shtml has some serious crap about parsing the query
string. Still, here it is:
function getSearchAsArray() {
var minNav3 = (navigator.appName == "Netscape" &&
parseInt(navigator.appVersion) >= 3)
var minIE4 = (navigator.appName.indexOf("Microsoft") >= 0 &&
parseInt(navigator.appVersion) >= 4)
var minDOM = minNav3 || minIE4 // Baseline DOM required for this
function
var results = new Array()
if (minDOM) {
var input = unescape(location.search.substr(1))
if (input) {
var srchArray = input.split("&")
var tempArray = new Array()
for (i = 0; i < srchArray.length; i++) {
tempArray = srchArray.split("=")
results[tempArray[0]] = tempArray[1]
}
}
}
return results
}
function loadFrame(varName,fName) {
/*
varName is the "name" part of the name/value pair in the query-string/
URI
fName is the name of the frame passed.
*/
var url = "aboutus.shtml";
if (location.search) {
var srchArray = getSearchAsArray()
if (srchArray[varName]) {
var url = srchArray[varName]
//alert (url);
}
}
//alert(top.opener.document.forms[0].target);
parent.frames[fName].location = url;
}
The actual frameset of popupframe.shtml is:
<frameset rows="127,*" onLoad="loadFrame('content', 'lowerFrame')">
<frame src="topFrame.shtml" scrolling=no marginwidth=0
marginheight=0 name="upperFrame" id="upperFrame">
<frame src="javascript:' '" name="lowerFrame" id="lowerFrame">
</frameset>
Again, I'm trying to submit the search from the main page to the
popup's "lowerFrame" frame.
Oh yeah, topFrame.shtml is my banner page (kinda like Google's image
search results ... after you click on an image, of course).
BTW, the commented line that reads:
//alert(top.opener.document.forms[0].target);
returns a privacy/illegal action exception of some sort. Otherwise,
the intention was to change the target of the main page's form to be
the intended frame.
Again, any help would be greatly appreciated. After several hours on
a couple of days, I'm just too fried to see straight.
Thank you in advance.