how to do parsing and then storing content in the buffer

Discussion in 'Javascript' started by vk, Jul 21, 2006.

  1. vk

    vk Guest

    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
    vk, Jul 21, 2006
    #1
    1. Advertising

  2. vk

    Randy Webb Guest

    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/
    Randy Webb, Jul 21, 2006
    #2
    1. Advertising

  3. vk

    Philipp Guest

    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].
    Philipp, Jul 22, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raja
    Replies:
    12
    Views:
    24,395
    John Harrison
    Jun 21, 2004
  2. Mufasa
    Replies:
    7
    Views:
    412
    Alexey Smirnov
    Sep 4, 2007
  3. xingye
    Replies:
    9
    Views:
    274
    Michael Lu
    Apr 19, 2004
  4. Replies:
    0
    Views:
    274
  5. Replies:
    4
    Views:
    538
    cwdjrxyz
    Jan 17, 2006
Loading...

Share This Page