473,396 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Pass Query String to Frame src using Javascript

I am using frames on a website. The title link on the title page adds a query string. The link goes to a page with two rows the second has two columns. I want the right column to be changed depending on what the query string is. I have the script to parse the query string here:
Expand|Select|Wrap|Line Numbers
  1. function getQueryVariable(variable) {
  2.     var query = window.location.search.substring(1);
  3.     var vars = query.split("&");
  4.     for (var i=0;i<vars.length;i++) {
  5.         var pair = vars[i].split("=");
  6.         if (pair[0] == variable) {
  7.             return pair[1];
  8.         }
  9.     } 
  10.     alert('Query Variable ' + variable + ' not found');
  11. }
  12. var PageLocation = "school/"+getQueryVariable("page")+".html"
The frame is named school and uses this html code:
Expand|Select|Wrap|Line Numbers
  1. <frame noresize frameborder=0 name="school" src="">
I want the frame src to be the “PageLocation” variable. How do I do this in Javascript?

The other way is to have the Javascript direct the frame to the correct page but I don’t know how to do this.

Thanks,
Josh
Jul 11 '08 #1
2 5616
Sorry I forgot to say that the first code in Javascript the other code is HTML.
Jul 12 '08 #2
acoder
16,027 Expert Mod 8TB
First you need to access the frame. This depends where the JavaScript code is. Yo can use top to get to the top window. Then use location.href to change the page:
Expand|Select|Wrap|Line Numbers
  1. top.school.location.href = PageLocation;
Sorry I forgot to say that the first code in Javascript the other code is HTML.
If you felt you needed to point that out, you can't have much confidence in the person answering your question ;)
Jul 12 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Nath | last post by:
Please help!? I am new to writing html, javascript, pretty new to MySQL but quite proficient at writing Perl and i'm a quick learner. I am building a database driven website and i am a little...
2
by: Tim Simmons | last post by:
I am stumped. I encoded the action = of my form using GET and I can't seem to get the property/value stuff from it using a JavaScript script I got from the web. I want to create a trivia game...
3
by: DCB | last post by:
Hello. I have an easy question, likely, that has me in a headspin. I have an include file to a frames based site that basically forces frames on the end user if they visit the site and hit a...
4
by: news-server.tampabay.rr.com | last post by:
Hi, Below is a stock script I found which controls a framed environment. My problem is that if a URL has a query string attached, that string does not pass through. Can someone please let me...
9
by: Java script Dude | last post by:
In many languages, it is necessary to string together multiple strings into one string for use over multiple lines of code. Which one is the most efficient from the interpreters perspective: ...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
7
by: Andy | last post by:
Hi, I have a complicated question that I'm hoping someone can help me out with. I have a webpage that contains a plug-in. This plug-in can communicate/pass data with the webpage that contains it...
1
by: mailing | last post by:
Hello, I am hoping that someone can point me in the right direction. I have 4 frames to my site. Two Rows, Two Columns. |--------------------------------|-------------------------| | ...
1
by: acehigh1983 | last post by:
hi i have been writting some HTML code and i have a web page that sends a username and password via a form post (can also use get) to another HTML page. I need to get the variables out of the query...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.