<a href="?id=home">Home</a>

is there any option available in Javascript for getting value of "?id=home" ????

Recommended Answers

of course there is, what part of it do you need exactly?

Jump to Post

All 4 Replies

of course there is, what part of it do you need exactly?

in php I get value "home" for this, <a href="?id=home">Home</a>

How to get "home" using javascript?

of course there is, what part of it do you need exactly?

The thing you are getting there is the text content of the link element - it seems{?}
and it is a lot easier to strip correctly.
And, it is valid and usable for as long as the link inner-text values are correct as well.
In that case a simple line of code will do your thing:

lnk = document.links['linkId'].innerHTML; //the following is, sport.
alert(lnk);  // >> "Home"
delete lnk; //[*]as soon as your'e done using it.

* because undeclared variables are erasable: meaning "green"; "biodegradable", environmentally friendly and pollution free.

Thanks..!!!

The thing you are getting there is the text content of the link element - it seems{?}
and it is a lot easier to strip correctly.
And, it is valid and usable for as long as the link inner-text values are correct as well.
In that case a simple line of code will do your thing:

lnk = document.links['linkId'].innerHTML; //the following is, sport.
alert(lnk);  // >> "Home"
delete lnk; //[*]as soon as your'e done using it.

* because undeclared variables are erasable: meaning "green"; "biodegradable", environmentally friendly and pollution free.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.