views:

60

answers:

4

how can i change the style of menu, if it is selected, without php? i can do it by php

`<? if($_GET[id] == "this_menu") echo "style='color:red'"?>` 

but i want to do it without php. is it possible? thanks

A: 

Do you want to do that on client? if so, use JavaScript.

Mendy
@Mendy es, of corse on client, but how can i verify the GET array via javascript?and why the down vote?
Syom
Look on `document.location`.
Mendy
+1  A: 
janmoesen
A: 

With JS

document.getElementById(gup("param")).setAttribute('style', 'color: red');

function gup( param ) {

var name = param.toLowerCase();
var regexS = "[\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS ); var tmpURL = window.location.href;
var results = egex.exec( tmpURL );
if( results == null ) { // Try to find an alternative value
if (typeof alternatives == "object") {
if(typeof alternatives[name] !="undefined") { return alternatives[name];
}
} return "";
} else {
return results[1];
} };

Ivo
A: 

it can be done easily done by javascript:

use something like this

document.getElementById('myMenu').style.color='#f0f0f0';

nik