PDA

View Full Version : Next URL JavaScript?


EdScript
11-20-2002, 08:42 PM
Would anyone know of any JavaScript that would allow you to display what the url will look like that your sending before you hit the submit button .

Lets say your currently in:

http://www.mypage.com/CRISSRC2.HTML

and when you press submit the next page has a url of:

http://www.mypage.com/CRISSRCH.REXX?STAC=OPEN&PRII=1

Is there anyway to tell while you're still in the first page what the url your going to send to the server will look like without having to try build it. Like an alert(document.nextURL) << just made that up, but something like that?

Thanks,
Ed

Membie
11-21-2002, 12:10 AM
I knew I saw it Somewhere... (http://javascript.internet.com/navigation/pop-up-link-with-description.html) ;)

x_goose_x
11-21-2002, 03:23 AM
I think this is what (s)he meant.


<script>

function geturl(what) {
a = what.action;
url = a+"?";
for (x=0; x<what.elements.length; x++) {
if (what.elements[x].type.toLowerCase() != "button") {
url += what.elements[x].name+"="+what.elements[x].value+"&";
}
}
url = url.substring(0,url.length-1);
alert(url)
}

</script>

<a href="javascript: geturl(formname);">GET URL</a>


Tested in IE6