In my experience, getElementsByTagName() is notoriously unreliable  
and will give different answers at different times for no apparent  
reason. Write a function to replace it and use that instead.

Guy

On 14/12/2006, at 3:32 AM, vinay wrote:

> I have a problem with ajax
>
> Actually i do not know whether its an ajax issue or its with
> AdobeSVGViewer
>
> I have developed orgchart.
> I specified a link which would get me the direct reportees of a
> manager(orgchart node) and when you click on the link (+) it would
> make an ajax call to get the direct reports and it would display them
> in svg.
> and change the link text to (-).
>
> Now when I again click on (-) the direct reports would vanish ( am
> actually removing the node using removeChild() method). Which would
> again make the link text to (+)
>
> Now the problem is , when i click on the (+) it throws and error
> getElementsByTagName(...).item(..) is null. Which does not make sense
> cause the first time its working and the second time it fails.
>
> And most importantly third time it does not fail. And from the third
> time it behaves randomly. Which makes my head go round and round..
>
> I even tried to display the node details (ie the svg content ) all is
> correct.
>
> And one very important thing. This only happend in IE, Not in Mozilla
>
> Can some body help me please. Am I missing some point here????
>
> Following is the code snippet
>
>
> function getUserId(node){
>  var userId = null;
>   if (node){          
>    userId =
> node.getElementsByTagName("user").item(0).getAttribute("id"); // Place
> Where the error shows up
>   }
>  return       userId;
> }
>       
>
>
> // Ajax Call back method
>
> function callback(userId,page_request){
>  if ((page_request.readyState == 4)) {
>   if (page_request.responseText!="" ) {                               
>    var drNodes =
> convertStrToDomNode(page_request.responseText).firstChild;
>       //alert(drNodes.getAttribute("id").indexOf("DIRECTREPORTEES_"));        
>                         
>        if (drNodes.getAttribute("id").indexOf("DIRECTREPORTEES_")>=0){
>         if (drNodes.childNodes.length >0){
>       
>          var newUserId = getUserId(drNodes.firstChild);// Place where the
> error starts                                                                  
>
>               var managerNode = SVGDocument.getElementById("USER_"+userId);
>               var directreporteesNode =  getDIRECTREPORTEESNode(managerNode);
>               if (directreporteesNode == null || directreporteesNode == ""){
>
>
>
> Thanks in Advance
> Vinay Gajjala
>
>
>
> -----
> To unsubscribe send a message to: svg-developers- 
> [EMAIL PROTECTED]
> -or-
> visit http://groups.yahoo.com/group/svg-developers and click "edit  
> my membership"
> ----
> Yahoo! Groups Links
>
>
>



-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to