Solved

Pass param to html file

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

920 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