[Wylug-help] Solved - silly javascipt problem
Gary Stainburn
gary.stainburn at ringways.co.uk
Tue Nov 10 15:52:57 UTC 2009
On Tuesday 10 November 2009 14:48:11 Gary Stainburn wrote:
> Hi folks,
>
> I've gone code blind. can someone please tell me where I've gone wrong
> with the following. Firefox/Firebug doesn't complain but it stops at the
> match() statement, i.e. the 'After Match' alert doesn't action.
>
> var MyURL=window.location;
> alert(MyURL);
> MyURL=MyURL.match(/ringways.co.uk(.*\.html)/);
> alert('Aftr match');
> alert(MyURL);
> window.location=MyURL+response[1];
I said it would be simple didn't I.
The code should have been
var MyURL=window.location.href;
MyURL=MyURL.match(/\.co\.uk(.*\.html)/)[1];
1) I had copied the object not the string
2) I wasn't subscripting the resulting array
--
Gary Stainburn
Gary's Haircut 700
Please visit http://www.justgiving.com/Gary-Stainburn/ to help me
raise money for Cancer Research - in return I'll have my head shaved
More information about the Wylug-help
mailing list