Click to See Complete Forum and Search --> : Passing Page Addresses from Page to Page.


Zodius
07-30-2006, 08:54 AM
Hi,

I'm new to this forum, so forgive me if my question seems obvious. There are two websites that exist, that are run by two different groups. Both groups wish to merge the sites into one, but have a distinction so you know which page relates to which group.

The way I have done this is as follows. I have made a standard layout in two different themes that corespond to each group, one being gold, and another being silver. Each page consists of a nav bar (which is quite graphical) and an iframe where the contents will load. When a user presses a button a page will load in the iframe, which means that the nav bar only has to load once.

This nav has links relating to both gold, and silver sites so users can easily access one site and the other. The problem with this is that a user can load a page which is designed to go with silver site, in the gold groups nav. I don't want this to happen.

The way I got arround this is by having the other groups nav load when a user trys to open something related to thar group. To do this, I used This (http://www.htmlgoodies.com/beyond/javascript/article.php/3471111) code from HtmlGoodies, which allowed me to specify a frame parameter in the url.

This did work partially, and I could extract the page from the url and display it in the iframe. The problem is that errors kept cropping up. I am not sure of the reason for this, but I believe its because, when the user accesses the main page of the site via http://id.tauniverse.com , there is no ?frame=*pagename*, and this caused the code to not work correctly.

I am not sure whats wrong, but I tried to make the code search for the ? and when not present load a default page into the iframe, but this still didn't fix the problem.

Could someone help me with this little problem, as it is hindering the progress of the site?


var locate = window.location
document.frame.target.value = locate

var text = document.frame.target.value

function Extract(URL)
{
theleft = URL.indexOf("?");
theright = URL.lastIndexOf("?");
if(URL.substring(theleft, theright + 1) == "?")//checks if ? is present
{
point =URL.lastIndexOf("=");//copied from the code off htmlgoodies
return(URL.substring(point+1,URL.length));
}
return("About.html");//default page
}
</SCRIPT>

<BODY onload="Frame(Extract(text))">

<FORM name="frame">
<INPUT type="hidden" name="target">
</FORM>

That is all of the relevant code. For some reason i keep getting errors, and the onload command isn't working correctly.

Does anybody know what I have done wrong?

Thanks
-1

Zodius
07-30-2006, 01:38 PM
Anybody? Ok, here is an example of the type of page that will be in the iframe.

http://id.tauniverse.com/MAD-TA/Units/Vehicles.html

That is obviously the silver version, and therefore would look out of place with a gold nav.

Any help would be appreciated
-1

Zodius
07-31-2006, 12:38 PM
Anybody? I know people are viewing the thread, but I am just looking for advice and a direction to head in.

Thanks
-1