[Javascript] Selecting certain areas of text in a string
javascript at webdesignofficina.com
javascript at webdesignofficina.com
Tue Mar 10 10:35:56 CDT 2009
Hi there,
Currently trying to change the url of an embedded element in a page...
My problem is that many other parameters are passed along the url of
the object, in the src property:
src="../pluginsv/mediaplayer.swf?file=http://www.somesite.com/video/
somevideo.flv&autostart=true&displayheight=202&allowfullscreen=over&controlbar=over&usefullscreen=true&backcolor=0x121212&frontcolor=0xffffff&lightcolor=0x000000&bufferlength=10"
I'd like to only rewrite this part: file=http://www.somesite.com/
video/somevideo.flv
Rest of the parameters should remain untouched...
I know I should use String.replace, something like:
var str="somevideo.flv!";
document.write(str.replace(/somevideo.flv/,"othervideo.flv"));
But I have absolutely no idea on how target this piece of text only in the
whole src="...", starting from ending file path, from / to .flv
Any help would be greatly appreciated.
Thank you.
Best regards,
Guillaume Stricher
More information about the Javascript
mailing list