SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Grabbing value from URL
-
Dec 22, 2006, 19:46 #1
- Join Date
- Jul 2006
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Grabbing value from URL
..
Last edited by TrainReq; Feb 6, 2007 at 19:26.
-
Dec 22, 2006, 21:00 #2
- Join Date
- Sep 2005
- Location
- Tanzania
- Posts
- 4,662
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
The best thing, in my opinion, would be to do it on the server side with PHP or some other language.
PHP Code:if($_GET['name']) {
echo '<div id="name" style="display:none;">' . $_GET['name'] . '</div>';
}
-
Dec 22, 2006, 21:41 #3
- Join Date
- Jul 2006
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It is a long story why.. but i NEED to have it done in Javascript.. no serverside will work.
-
Dec 22, 2006, 22:27 #4Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>Some Title</title> <script type="text/javascript"> function printLocation() { var loc = location.href var pairs = loc.split('name=') document.getElementById('response').appendChild(document.createTextNode(pairs[1])) } </script> </head> <body onload="printLocation()"> <div id="response"></div> </body> </html>
Patrick Smith
PHP Programmer
Bookmarks