/    Sign up×
Community /Pin to ProfileBookmark

JavaScript HTML Navigation

Let me try this again, Charles was not much help in my last post, he left me hanging.
How does this navigation work or how is it defined when you see a URL with a question mark after HTML and points to another page or inserts info from another page data into a table on the Index.HTML page?
http://www.cognigencorp.com/content/aboutus/index.html?nav=aboutus&sub=mission&title=Mission
Inserted from this page
http://www.cognigencorp.com/content/aboutus/mission.html
Does anyone know where I can get Instructions or a tutorial on how to do this in JavaScript and PHP? Or maybe what key words I should search for to find it?

Stuart

to post a comment
HTML

4 Comments(s)

Copy linkTweet thisAlerts:
@ryanbutlerMay 22.2007 — If its PHP, they're checking the contents of the address bar by the $_GET method in one page. If its true to a certain value then display that content. Something like:

[code=php]<?php

if($_GET['aboutus']){
//show about us content
}
else if($_GET['contact']){
//show contact content
}
else{
//show default content
}
?>[/code]
Copy linkTweet thisAlerts:
@ceetechsauthorMay 22.2007 — If its PHP, they're checking the contents of the address bar by the $_GET method in one page.[/QUOTE]

If it has and HTML extention then they are not using PHP right? I am looking for a JavaScript nav like they are using here

"http://www.cognigencorp.com/content/aboutus/index.html?nav=aboutus&sub=mission&title=Mission"

Thanks
Copy linkTweet thisAlerts:
@ryanbutlerMay 22.2007 — Technically, it could still be PHP, but more than likely its JavaScript. I've never done this with JS before, so I would Google personally. However, I would encourage you to opt for a server-side alternative.
Copy linkTweet thisAlerts:
@FangMay 22.2007 — If it has and HTML extention then they are not using PHP right?[/QUOTE]No, you can have any extension for any server-side language. You just tell the server which extension to parse.

The page in question uses a server-side language, not JavaScript.

Here's a way to strip the variables into an associative array using JavaScript:var str=location.search; // ?nav=aboutus&amp;sub=mission&amp;title=Mission
//str="?nav=aboutus&amp;sub=mission&amp;title=Mission"; //uncomment this line to se how it works
str=str.substring(1, str.length);
str=str.split('&amp;');
var menu=[];
for(var i=0; i&lt;str.length; i++) {
var pair=str[i].split('=');
menu[pair[0]]=pair[1];
}
alert("menu['nav']="+menu['nav']+"nmenu['sub']="+menu['sub']);
×

Success!

Help @ceetechs spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...