dontpunchme
Programmer
Hi,
I am trying grab a value that appears in a URL string. I am trying to get the "add" that appears after the "Submit=".
The script I have below works when there are no extra parameters.
output: add
but once you add in the extras "&taco&pizza" it spits out this.
output: add&taco
Also if I add parameters before the "Submit=", the output gets worse.
<script language="JavaScript">
var str = "var theleft = str.indexOf("Submit=") + 6;
var theright = str.lastIndexOf("&");
var total = (str.substring(theleft, theright));
document.write("output: ",total);
</script>
I think I may be going about this the wrong way.
Thanks for any quidance.
I am trying grab a value that appears in a URL string. I am trying to get the "add" that appears after the "Submit=".
The script I have below works when there are no extra parameters.
output: add
but once you add in the extras "&taco&pizza" it spits out this.
output: add&taco
Also if I add parameters before the "Submit=", the output gets worse.
<script language="JavaScript">
var str = "var theleft = str.indexOf("Submit=") + 6;
var theright = str.lastIndexOf("&");
var total = (str.substring(theleft, theright));
document.write("output: ",total);
</script>
I think I may be going about this the wrong way.
Thanks for any quidance.