SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    167
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Display None Not Working

    The end of my code is not working. div2[i].style.display = none; I don't understand why it won't work.

    Code:
    addOnload(function()
    {
        var link = document.getElementById('associateRequests');
        var link2 = document.getElementById('associateRequests2');
          
        if (link)
        {
            link.onclick = function()
            {
                var uid = link.href.split('=');
                uid = uid[1];
                
                ajax.get('/assets/ajax/partner_review.php?uid=' + uid, function(responce)
                {
                    var info = eval('(' + responce + ')');
                    var i;
                    
                    lightbox.show(info[0], function(body)
                    {   
                        var row = [];   
                        var div1 =[];
                        var a =[];
                        var img =[];
                        var span =[];
                        var div2 =[];
                        var div3 =[];
                        var input1 =[];
                        var input2 =[];
                        var requestform =[];
                        
                        for (i = 0; i < info[1].length; i++) 
                        {
                            
                            row[i] = document.createElement('div');
                            div1[i]         = document.createElement('div');
                            a[i]            = document.createElement('a');
                            img[i]         = document.createElement('img');
                            span[i]         = document.createElement('span');
                            div2[i]        = document.createElement('div');
                            div3[i]        = document.createElement('div');
                            input1[i]        = document.createElement('input');    
                            input2[i]        = document.createElement('input');
                            requestform[i]    = document.createElement('form');
                            input1[i].type = 'submit';
                            input2[i].type = 'submit';
                            
                            input1[i].value = 'Accept';
                            input2[i].value = 'Deny';
                            
                            input1[i].name = info[1][i].uid;
                            input2[i].name = info[1][i].uid;
                            
                            requestform[i].name = 'requestform';
                            requestform[i].method = 'post';
                            requestform[i].action = 'http://mysite.com/home.php';
                            
                            a[i].href = 'http://mysite.com/u/' + info[1][i].username;
                            a[i].setAttribute('target', '_blank');
                            
                            addClass(row[i], 'lb_row');
                            
                            img[i].src = info[1][i].avatar;
                            img[i].alt = info[1][i].displayName;
                            
                            row[i].appendChild(div1[i]);
                            
                            a[i].appendChild(img[i]);
                            div1[i].appendChild(a[i]);
                            addClass(div1[i], 'lb_div');
                            addClass(div1[i], 'tdfirst_review');
                            addClass(img[i], 'avatar extrasmall vmiddle');
                            
                            span[i].appendChild(document.createTextNode(info[1][i].displayName));
                            a[i].appendChild(span[i]);
                            addClass(span[i], 'lb_span');
                            
                            div2[i].appendChild(input1[i]);
                            row[i].appendChild(div2[i]);
                            addClass(div2[i], 'lb_div_button');
                            addClass(div2[i], 'lb_align');
                            
                            div3[i].appendChild(input2[i]);
                            row[i].appendChild(div3[i]);
                            addClass(div3[i], 'lb_div_button');
                            addClass(div3[i], 'lb_align');
                            addClass(div3[i], 'right');
                            
                            requestform[i].appendChild(row[i]);
                            body.appendChild(requestform[i]);
                            
                            input1[i].onclick = function() 
                            {
                                ajax.get('/assets/ajax/partner_accept.php?uid=' + this.name, function(responce)
                                {
                                	div2[i].style.display = none;
                                });
    							return false;
                            }
                            
                            input2[i].onclick = function() 
    						{
                                ajax.get('/assets/ajax/partner_deny.php?uid=' + this.name, function(responce)
                                {
                                	div2[i].style.display = none;
                                });
                                return false;
                            }
                        }
                    });
                });
            
                return false;
            }
        }
    });

  2. #2
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote attribute values.

  3. #3
    SitePoint Addict
    Join Date
    Nov 2008
    Location
    Thailand
    Posts
    329
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote attribute values.
    div2[i].style.display = 'none';


Bookmarks

Posting Permissions

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