HTML PHP SPAN ?? Span ID to display value based on the url?
www.mysite.com/?q=portraits#
I want a span within my menu to display the current section (ie. portraits)
I'm sure this is simple. Your help is much apprecia开发者_开发百科ted!
it's been a long time since i've used php, but the the variable you are referring to is what's known as a query string parameter, which is passed as a $_GET array in php. you can access the specific variable by using a string indexer of the array. in your markup:
<span><?php echo $_GET["q"]; ?></span>
You'll probably have to use javascript, if you're not working with PHP or something like that.
How to extract the get-query with javascript is explained here: How can I get query string values in JavaScript?
Then you can fork the result and add/remove content to/from the element you want to manipulate.
精彩评论