View Full Version : coding for directing links to various iframe in a same html file

01-03-2010, 07:43 PM
I am not sure if it is a question for javascript to make it work, but I give it a try here.

I have a flash page containing 3 different links, when each is clicked, it is supposed to send visitor to a html file displaying an <iframe> contents. Currently, I am doing a foolish way by making 3 separate html files. The difference among them is only that line has iframe in it. Do you think whether it can be programmed to be inside one html file but recognized the connection between the links in flash and the iframes they direct to.

Here are the iframes I have inside the html page

<iframe width="100%" height="550" frameborder="0" src="/portfolio/index.html?openfolder=1"></iframe>

<iframe width="100%" height="550" frameborder="0" src="/portfolio/index.html?openfolder=2"></iframe>

<iframe width="100%" height="550" frameborder="0" src="/portfolio/index.html?openfolder=3"></iframe>

I attach a stretch of what I thought.

Thank you.

01-04-2010, 06:40 PM
It cannot be programmed in an HTML file, but it can be programmed in a PHP file - check to see if your host supports PHP.

01-04-2010, 07:22 PM
Yes, my host does support php. how do I code though... Thank you.

01-04-2010, 07:42 PM
Ok, then give this a try:

switch($_GET['page']) {
case "1":
echo '<iframe width="100%" height="550" frameborder="0" src="/portfolio/index.html?openfolder=1"></iframe>';
case "2":
echo '<iframe width="100%" height="550" frameborder="0" src="/portfolio/index.html?openfolder=2"></iframe>';
case "3":
echo '<iframe width="100%" height="550" frameborder="0" src="/portfolio/index.html?openfolder=3"></iframe>';
echo "Page not found!";