Solved

Pass param to html file

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now