split not recognising return from regex as string?
I'm working on a function that checks the css href in an included html file and if it is incorrect it adjusts it. my problem is in this piece of code
Now the m variable is set before this piece of code, containing
hrefrege = /href=\"[^ ]+\"/i;
originalHref = m.match(hrefrege);
originalHrefArray = originalHref.split("/");
the originalHref matches the href="css/style_oud.css" however the split function doesn't recognise originalHref as a string.
<LINK HREF="css/style_oud.css" REL="stylesheet" TYPE="text/css">
Why doesn't it recognise it and how do i fix my problem?
Thanks in advance,
This script show that originalHref is an object. Than you have to build a string.
Split works better with all browsers with a regexp and a the option g...
var hrefrege = /href=\"[^ ]+\"/i;
var m='<LINK HREF="css/style_oud.css" REL="stylesheet" TYPE="text/css">';
var originalHref = m.match(hrefrege);alert(typeof(originalHref))
var originalHrefArray = originalHref.toString().split(/\//g);
Thanks alot, that did the trick!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)