Web Analytics Made Easy -
StatCounter dynamically changing parts of url's in an html code. - CodingForum

Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    <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>

    Comment

    Working...
    X