Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

JS help

  • 12-01-2008 02:45AM
    #1
    Registered Users, Registered Users 2 Posts: 6,240 ✭✭✭


    hey guys

    I have a <fieldset> lump of html code
    and I want to override certain values via JS
    e.g.
    <form .... name="addressForm" id="addressForm"...>
    <fieldset>
    <dl class="fsText">
       <dt>Street address:</dt>
       <dd>12/20 Sussex Street</dd>
       <dt>Suburb/ city:</dt>
       <dd>Parramatta</dd>
       <dt>State:</dt>
       <dd>NSW</dd>
       <dt>Postcode:</dt>
       <dd>2765</dd>
       <dt>Country:</dt>
      <dd>Australia</dd>
    </dl>
    </fieldset>
    </form>
    
    what happens, is when a user clicks on a button a popup will appear
    and will use an address searcher and return values
    the old way was to use <input> and overwrite the values.
    but the new way is to use <dd> .. but I'm not sure how I would

    the old way was : using the 'opener' method
    opener.myForm.Address[0].value = "street name"
    Address[0] was a input field
    so I am just wondering can I target the <dd> fields?
    I know there are easier ways to do this, but I'm stuck with politics
    :-)


Comments

  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    Two options - give each dd an id/name and reference the appropriate one by document.getElementById(idname).innerHTML or document.getElementByName(idname).innerHTML

    Alternatively, use document.getElementsByTagName('dd') (which will return an array of indexes to all the dd tags on the page. Count down to the one you wish to change and access the array to make the change.

    Personally, I would not use dl or dd (I just don't like the way ti lays out the data) but this may be out of your hands.

    Best of luck

    -RD


Advertisement