Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML-page's filename as a variable.

Status
Not open for further replies.

crycle

Programmer
Sep 17, 2001
2
FI
Due to a difficult frame structure on my site, I need to make it so that when pressing a link in certain frames, it gives a variable a value, and reloads index.html, which reloads the rest of the frames. Except, that in one of the frames there would be a script that checks the value of that variable, and gives the next page to be loaded this value. So if x is the variable, this script would check the value of x and load up x.html.
Is this possible? :)

"The solution is always a built-in feature."
 
When you reload the index.html page, all your variables lose the values they had before, so you'd have to pass that variable to the page through the URL to do what you wanted, then read the URL and load the appropriate page in the appropriate frame.
 

I don't really know much of javascript, like how to get a value from the url line or anything. This could turn out to be a difficult task for me. :D I have some kind of a big picture, yea, and I've programmed before. I just need to know the commands, how to make it all work. But the tutorials I've read have been pretty lame, not giving certain information or just not enough of it.
Oh well, I guess I'll just keep trying. Any help will be _greatly_ appreciated, too. ;)
 
i saw code for this somewhere before and dug up a copy. from the page where the link reside, you'd have something like...

Code:
<a href=&quot;webPage.html?valueToPass&quot;>Web Page</a>

then, from the page that is opened by the link, you'd have something like...

Code:
<script type=&quot;text/javascript&quot;>
<!--
if (location.search)
{ 
  myVariable = location.search.substring(1, location.search.length))
}
else
{
  myVariable = someValueToIndicateNoValuePassed
}
// -->
</script>

i think that should do it.

glenn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top