View Full Version : dynamically changing parts of url's in an html code.

Jun 18th, 2002, 11:07 PM
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

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 :)

Jun 18th, 2002, 11:13 PM

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;
obj[x] = unescape(tmp.substring(0,tmp.length));
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];

<body onload="loop();">