Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

JS help

Options
  • 12-01-2008 2:45am
    #1
    Registered Users 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