By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,238 Members | 1,320 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,238 IT Pros & Developers. It's quick & easy.

how to do parsing and then storing content in the buffer

P: n/a
vk

can you help me out in this
....
<IMG style="BORDER-RIGHT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: 0px;
PADDING-LEFT: 0px; LEFT: -108px; PADDING-BOTTOM: 0px; MARGIN: 0px;
BORDER-LEFT: 0px; WIDTH: 256px; PADDING-TOP: 0px; BORDER-BOTTOM: 0px;
POSITION: absolute; TOP: -175px; HEIGHT: 256px"
src="http://mt0.google.com/mt?n=404&v=ap.14&x=1314&y=3174&zoom=4"
unselectable="on" galleryImg="no" coordX="0" coordY="0" priority="0">

i need to parse this string and i have to fetch url and coordinates
value of X and Y from this and has to store them in buffer ..
can anybody provide me with coding for this ..
thanx in advance

Jul 21 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
vk said the following on 7/21/2006 4:12 AM:
can you help me out in this
Yes, what do I get for it?
....
<IMG style="BORDER-RIGHT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: 0px;
PADDING-LEFT: 0px; LEFT: -108px; PADDING-BOTTOM: 0px; MARGIN: 0px;
BORDER-LEFT: 0px; WIDTH: 256px; PADDING-TOP: 0px; BORDER-BOTTOM: 0px;
POSITION: absolute; TOP: -175px; HEIGHT: 256px"
src="http://mt0.google.com/mt?n=404&v=ap.14&x=1314&y=3174&zoom=4"
unselectable="on" galleryImg="no" coordX="0" coordY="0" priority="0">
Hmmm, lots of IE crap code in there that doesn't affect me, but ok.
i need to parse this string and i have to fetch url
"fetch url"? Just read it's src property.
and coordinates value of X and Y from this
getAttribute('coordX')
getAttribute('coordY')
and has to store them in buffer ..
What buffer?
can anybody provide me with coding for this ..
Probably so.
thanx in advance
Sure.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 21 '06 #2

P: n/a
Randy Webb wrote:
and coordinates value of X and Y from this

getAttribute('coordX')
getAttribute('coordY')
I suppose what he actually wanted to know was how to parse the coordX
and coordY parameters with a regular expression and...
and has to store them in buffer ..

What buffer?
.... store the matches in an array or something.
can anybody provide me with coding for this ..
There you go:
-------------------------------------

var foo = '<IMG style="BOR [...] oordY="0" priority="0">';
var match =
foo.match(/src="([^"]+)".*?coordX="(\d+)".*?coordY="(\d+)"/);

-------------------------------------

You'll find the URL in match[1], the X coordinate in match[2] and the
the Y coordinate in match[3].

Jul 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.