Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    TrainReq
    Guest

    Exclamation Grabbing value from URL

    Right now... i have it to where it grabs the value username by putting in a div.
    (For example if i do <div name="John" id="name" style="display:none;">) it will make the value for username John .... i did that by doing this line of javascript:
    Code:
    function getusername(){var name_div=document.getElementById('name');if(name_div){var username=name_div.getAttribute('name');if(username)return username;}var i,j,h,s;h=document.location.href;s='usrn=';i=h.indexOf(s);if(i==-1)return '';i+=s.length;j=h.indexOf('&',i);if(j==-1)return '';return h.substring(i,j);}
    What will i have to change in that code to get username from the URL by going for example http://site.com/file.html?name=John (with file.html having the javascript on it) or http://site.com/file.html?name=Bob ... (wich will make the value for getusername Bob)

    More/less , i would like to do ?name=USERNAME in a URL instead of having to do <div name="USERNAMEHERE" id="name" style="display:none;">
    Last edited by TrainReq; 12-22-2006 at 11:16 PM.

  • #2
    TrainReq
    Guest
    bump

    -


  •  

    Posting Permissions

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