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
    New Coder
    Join Date
    Jun 2002
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation dynamically changing parts of url's in an html code.

    I'm wondering if someone knows a way to have a visitor to a page input 2 fields, ID and password... and apply those fields to url's in already made pages.

    So for example in a page would be the link
    http://page.com/stuff/something.cgi?ID=SUPPLIEDID&PASS=SUPPLIEDPASS&CONTENT=blahblah

    And the bolded parts of the url would be changed to the supplied id and password.

    Is this possible with javascript even?

    I don't have access to the site the links are to, making my own "interface" for an online game and am thinking of ways to easily allow others to use it as well. Thanks for the help
    blek..

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Montreal, Canada
    Posts
    644
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <html>

    <head>
    <script>
    obj = new Array();
    x = 0;
    tmp = location.search;
    function loop() {
    tmp = tmp.substring(tmp.indexOf("=")+1,tmp.length);
    if (tmp.indexOf("=") > 0) {
    obj[x] = unescape(tmp.substring(0,tmp.indexOf("&")));
    x += 1;
    setTimeout("loop()",10);
    }else{
    obj[x] = unescape(tmp.substring(0,tmp.length));
    whattodo();
    }
    }
    function whattodo(){
    // change formname to the actual form name and the field names to the corresponding fields.
    document.formname.user.value = obj[0];
    document.formname.pass.value = obj[1];
    document.formname.content.value = obj[3];
    }
    </script>
    </head>

    <body onload="loop();">

    </body>

    </html>


  •  

    Posting Permissions

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