SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    Sausalito, Ca
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why doesn't this work?(JS)

    So confused, help please

    /*
    var getQueryString = document.location;
    var queryString = getQueryString.split("?");
    alert(queryString[0]);
    */

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    Sausalito, Ca
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    figured it out:


    /*
    var getQueryString = new String(document.location);
    var queryString = getQueryString.split("?");
    alert(queryString[0]);
    */

  3. #3
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey eli,

    FIrst of all, window.location has been opted for instead of document.location. Second of all, you could use this:

    var getQueryString = window.location.toString();

    or to return a string respresentation of the location automatically, use this:

    var getQueryString = window.location.href;

    aDog


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
  •