Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problems manipulating child element

    <div id="Agt18961">
    <span id="AgtName">Tonto Fodder</span>
    <span id="Comm">23.56</span>
    </div>


    I have the following being output by a db. I am trying to access the "Comm" and add or subtract whatever values are passed from the parent form.

    var iNewComm = document.getElementById(strOldAgent);
    var myTest = iNewComm.childNodes[1].nodeValue;
    alert(myTest);



    strOldAgent is a value passed from the parent form. Whenver I run this script the alert box is blank. Any ideas? This is for ie5 and up.
    Last edited by allida77; 10-18-2002 at 02:01 PM.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    217
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That should be childNodes[0].nodeValue;

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    now in my alert box I get a "Null"

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It works for me, how doy you pass 'strOldAgent'? Maybe you don't get the right id passed, perhaps you trace it's value with alert(strOldAgent) at the start of your function.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I guess it helps when you refresh the window. Thanks for the help.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •