SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2010
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I change the URL

    Hi guys,

    In my book I'm going thru, there is the example below to demonstate the location property; After I run this code, the author wants me to "modify the URL that I use to call the page, to add some query string parameter/value, such as 'name=Jeff and country = US', and run the code again".
    He doesn't tell me how to modify the URL, though, so how do I modify the URL?

    Thanks,
    Jeff


    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
        <title>Location, Location, Location</title>
        <script type = "text/javascript" >
            function showProps() {
                var body = document.getElementsByTagName("body")[0];
                for (var prop in location) {
                    var elem = document.createElement("p");
                    var text = document.createTextNode(prop + ": " + location[prop]);
                    elem.appendChild(text);
                    body.appendChild(elem);
                }
            }
        </script>
    </head>
    <body onload="showProps()">
    <p>Chapter 9 Example</p>
    </body>
    </html>
    Last edited by Mittineague; Jan 15, 2011 at 15:45. Reason: reformatting bbcode tags

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's no coding involved, all it means is to append some parameters to the URL in the address bar.

    To load the page you may type: mypage.htm

    Instead you may add parameters: mypage.htm?partNum=83453&desc=bolt

    The purpose being presumably to see the search property change in the display generated.
    Tab-indentation is a crime against humanity.

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2010
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh great...that was simple enough! Thanks Ali


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •