/    Sign up×
Community /Pin to ProfileBookmark

Manipulating a string contained in a HTML table data

Hi ,

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

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

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.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@ZABIOct 09.2012 — i don't understand what actually you need. anyway give it a try to path.split('/');
Copy linkTweet thisAlerts:
@xelawhoOct 09.2012 — you could slice the string...
[CODE]
<script>
var path='<a href="coll.pl?path=/home/common/units">'
var mypath=path.slice(path.lastIndexOf('=')+1,path.lastIndexOf('"'))
alert(mypath)
</script>
[/CODE]
Copy linkTweet thisAlerts:
@myuserauthorOct 10.2012 — Thank you xelawho. It works.
×

Success!

Help @myuser spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...