Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Pass param to html file

Posted on 2001-08-05
2
Medium Priority
?
146 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 400 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

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 …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

721 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