User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,858 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,593 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 7434 | Replies: 9
Reply
Join Date: Mar 2005
Location: Nebraska, U.S.
Posts: 187
Reputation: stupidenator is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 4
stupidenator's Avatar
stupidenator stupidenator is offline Offline
Junior Poster

window location using frames

  #1  
Jun 26th, 2005
Hey all.
I have been messing around with javascript for a while now and I am not all too good with it. I built a little javascript program that takes the input from a text box and depending on what's in there, it goes to a certain page. I am using
window.location("url here");
my problem is that I have this script loaded on a page with frames and this loads in the top frame. When the script is executed, it opens the new page in the top frame, but I need it to open the page in the bottom frame. Can anyone help me understand how to do this? Thanks in advance.
-Nick
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Posts: 1,589
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 34
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: window location using frames

  #2  
Jun 26th, 2005
I'm not sure where the concept of "bottom" fits within the frame hierarchy. But you can refer to specific frames using an indexer of the frame collection:

frames[1], frames[2], and so on.

Also look at the "top" and "parent" objects, and possible the "this" keyword, the "self" object, and so on. Seeing some code would help us help you.
Reply With Quote  
Join Date: Mar 2005
Location: Nebraska, U.S.
Posts: 187
Reputation: stupidenator is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 4
stupidenator's Avatar
stupidenator stupidenator is offline Offline
Junior Poster

Re: window location using frames

  #3  
Jun 27th, 2005
here is the code for it.

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
var g;
function track()
{
g=document.log1.T1.value;

if (g.length == 18 || g.length == 24) { window.location="http://wwwapps.ups.com/WebTracking/processInputRequest?InquiryNumber1="+g+"&AgreeToTermsAndConditions=yes&track.x=22&track.y=4"; }
else { window.location="http://search.ebay.com/search/search.dll?satitle="+g; }

}
//  End -->
</script>

when the submit button is pressed, it calls the track() method and with the way it is set up now, it opens it in the same frame. I need to be able to have the script open it in another frame. Thanks for your help!
Nick
Reply With Quote  
Join Date: Dec 2004
Posts: 1,589
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 34
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: window location using frames

  #4  
Jun 27th, 2005
Thanks. We'll need to see your stripped-down frameset code, so we can see how many frames you have, their relationship to each other, the IDs you've given them, and so on.
Reply With Quote  
Join Date: Mar 2005
Location: Nebraska, U.S.
Posts: 187
Reputation: stupidenator is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 4
stupidenator's Avatar
stupidenator stupidenator is offline Offline
Junior Poster

Re: window location using frames

  #5  
Jun 27th, 2005
Here is the frameset page. Thanks for your help.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link REL="shortcut icon" HREF="images/icon.jpg" TYPE="image/x-icon"> 
</head>

<frameset rows="115,*" frameborder="NO" border="1" framespacing="0">
  <frame src="header.html" name="topFrame" scrolling="NO" noresize >
  <frame src="home.html" name="mainFrame">
</frameset>
<noframes><body>
<h2><center>Your Browser does not support Frames which are in use on the page you are trying to view. Please re-adjust your browser and try again. Thank you.</center></h2>


</body></noframes>
</html>
Nick
Reply With Quote  
Join Date: Dec 2004
Posts: 1,589
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 34
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: window location using frames

  #6  
Jun 27th, 2005
Modify your window.location statement in your track() procedure to reference a specific frame, rather than the entire "window":

top.frames["mainFrame"].location.href="www.tgreer.com";
Reply With Quote  
Join Date: Mar 2005
Location: Nebraska, U.S.
Posts: 187
Reputation: stupidenator is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 4
stupidenator's Avatar
stupidenator stupidenator is offline Offline
Junior Poster

Re: window location using frames

  #7  
Jun 27th, 2005
Thank you very much for the help. It does work! But if I can ask one more quesiton, I am not really understanding the 'top' call in
top.frames["frame"].location="www.com";
Could you maybe explain that a little bit? Thank you for replying
Nick
Reply With Quote  
Join Date: Dec 2004
Posts: 1,589
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 34
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: window location using frames

  #8  
Jun 27th, 2005
"Top" is the top-level window object in the hierarchy. Think of it as your "frameset" page.

So "top" contains all of your frames. You're saying, "go to the top window object, look into all the frames it contains, find the one named 'mainFrame', and set that frame's location to the URL 'www.tgreer.com'.
Reply With Quote  
Join Date: Mar 2005
Location: Nebraska, U.S.
Posts: 187
Reputation: stupidenator is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 4
stupidenator's Avatar
stupidenator stupidenator is offline Offline
Junior Poster

Re: window location using frames

  #9  
Jun 27th, 2005
Thanks a lot! I understand that now!
-Nick
Reply With Quote  
Join Date: Dec 2004
Posts: 1,589
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 34
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: window location using frames

  #10  
Jun 27th, 2005
You're welcome!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 6:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC