473,800 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass Query String to Frame src using Javascript

44 New Member
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 5644
I Hate My Computer
44 New Member
Sorry I forgot to say that the first code in Javascript the other code is HTML.
Jul 12 '08 #2
acoder
16,027 Recognized Expert Moderator MVP
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
6791
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 stuck: I have page of results obtained from a MySQL query presented as a table (the first column having checkboxes for each of the rows in the table, and all having the name "seqs"). I have set up a javascript (connected to a "toggle all" checkbox)...
2
2221
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 where the user gets 1 question at a time and it keeps scoring until the end and gives a summary and I want to do it only in JavaScript (no ASP, PHP, JSP, etc). I tried submitting the quiz page to itself using a query string to keep track of...
3
32152
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 non-frames created page... Simply, it is: if (parent != self)
4
4817
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 know if and hopefully how, it will be possible to carry a query string through? This first part here is in the default.asp framed page. <SCRIPT LANGUAGE="JavaScript">
9
5772
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: Case 1: str += '<?xml version="1.0" encoding="' + charset + '"?>\n'; str += '<view-source-with version="1.1">\n'; str += ' <default-item-index>' + this.defaultItem + '</default-item-index>\n';
7
21642
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 server ? Is it possible to use parameters in pass-through queries ? An additional question: Is it possible to connect to a database on MySQL or PostgreSQL using ADO ? Is it possible to execute pass-through queries with parameters, using ADO...
7
4455
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 via javascript. What I need to be able to do is take that data passed via javascript and, using vb.net as the code behind language, send it to a database without posting it because when I post, the plugin is reloaded and starts at the beginning....
1
2293
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 | 2 | | | | |--------------------------------|-------------------------| | ...
1
1781
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 string and into 2 textboxes, these will then be passed into an IFrame containing a webpage from a third party. here is the query string i get in the navigation bar using the get method. ...
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10255
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10036
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9092
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.