...

problems manipulating child element

allida77
10-18-2002, 01:49 PM
<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.

Bosko
10-18-2002, 02:29 PM
That should be childNodes[0].nodeValue;

allida77
10-18-2002, 02:36 PM
now in my alert box I get a "Null"

mordred
10-18-2002, 03:58 PM
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.

allida77
10-18-2002, 04:20 PM
I guess it helps when you refresh the window. Thanks for the help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum