I would like to take the url which would be something along the lines of http://blahblahblah.com…&substring=CH+BH+LH
and then extract everything after the ‘&’, remove the ‘CH+’ and then put this new string into a field called “subform” using javascript.
can someone help me out with this code? Thanks
Subject: string operations with javascript
Take a look at the javascript indexOf and substring functions
Subject: RE: string operations with javascript
You might also look at regular expressions, e.g.:
var myURL = “http://blahblahblah.com/something&CH+BH+LH”;
var re1 = new RegExp(“^.+&”); // any characters followed by “&”
var temp = myURL.replace(re1,“”); // replace that string with “”
alert(temp); // will show “CH+BH+LH”