...

View Full Version : Manipulating a string contained in a HTML table data



xaverian
10-09-2012, 10:57 AM
Hi ,

I have javascript variable (var path) which is conatining the table data of particular table row and column. Following line is the code :



var path = mytable.rows[i].cells[3].innerHTML;

The 'path' variable is containing :

<a href="coll.pl?path=/home/common/units">(/home/common/units)</a>

My requirement is to extract the path information (i.e /home/common/units )
from the above string. How can I do that ?

Please help.

Thanks.

devnull69
10-09-2012, 11:12 AM
Try the following code which uses a regular expression


var myRegex = /path=(.*)"/;
path = path.match(myRegex)[1];

xaverian
10-09-2012, 11:53 AM
Thanks a lot devnull69. It is working.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum