#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    1
    Rep Power
    0
    Lets say i have a link

    <a href="index.html?x=1">

    Can i retrieve this "x" in the index.html using JavaScript ???

    Thanks alot !!!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Location
    Münster (Germany)
    Posts
    44
    Rep Power
    14
    You can do something like this in your index.html.
    I've tried it just once and it worked, but I'm no expert in this.
    So when you call the index.html but something like
    <a href="index.html?x=1">
    after the function you should be able to call the variable
    x and get the value 1.

    var URL = unescape(window.document.location);

    if (URL.indexOf("?") > -1) {
    //whether the location contains a "?" or not

    var list1 = URL.split("?");
    //split at "?";
    var list2 = list1[1].split ("=");
    //split at "=";
    var list2[0] = list2[1];
    //assignment
    }

    I hope it works.

IMN logo majestic logo threadwatch logo seochat tools logo