Solved

Pass param to html file

Posted on 2001-08-05
2
144 Views
Last Modified: 2012-05-04
Hi,

I have to html pages the first page has links that shoud be opened on the second page.

My problem is that the second page includes ifram and I want to open specific file on that ifram.

For example when I click on "link 1" in the first page it should open the second page and load "link1.html" on the ifram , also when I click on "link 2" in the first page it should open the second page and load "link2.html" on the ifram and so on.

Any idea ?


Regards
0
Comment
Question by:Zuhair070699
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
CJ_S earned 100 total points
ID: 6354849
You can do that with the querystring.

Add the following script to the second page:
<script>
var QueryString = new Array();
lArr = location.search.substring(1).split("&");
for(i=0;i<lArr.length;i++)
{
   t = lArr[i].split("=");
   QueryString[t[0]] = unescape(t[1]);
}
</script>

And at the place where you have the iframe, you make that:

<script>
str = "<iframe src='"+QueryString["url"]+"'></iframe>";
document.write(str);
</script>

Now load the second page using the following like:
href="secondpage.html?url=link2.html"


Regards,
CJ
0
 

Author Comment

by:Zuhair070699
ID: 6358444
Thanks that exactly what I want :)
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question