Solved

Pass param to html file

Posted on 2001-08-05
2
140 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

761 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