Page 1 of 1

Onblur Fails... Onclick works?!

Posted: Fri May 20, 2011 7:38 pm
by unemployment
Why won't onblur work? onclick works!
var allDivs = document.getElementsByTagName('div');
for (var i=0; i< allDivs.length; i++)
{
    if (allDivs.className.indexOf('goal_icon_holder') != -1)
    {
        allDivs.onblur = function()
        {
            alert('test');
        }
       
        allDivs.onclick = function()
        {
            alert('test');
        }
    }
}

Re: Onblur Fails... Onclick works?!

Posted: Fri May 20, 2011 8:29 pm
by jacek
perhaps divs don’t have focus events, it would not make much sense.

Re: Onblur Fails... Onclick works?!

Posted: Sat May 21, 2011 3:08 am
by unemployment
jacek wrote:perhaps divs don’t have focus events, it would not make much sense.
perhap you are right... in fact you are correct.

Re: Onblur Fails... Onclick works?!

Posted: Mon May 23, 2011 1:11 pm
by unemployment
I finally fixed my awful JS problem... 7 days later err

Re: Onblur Fails... Onclick works?!

Posted: Mon May 23, 2011 1:15 pm
by jacek
unemployment wrote:I finally fixed my awful JS problem... 7 days later err
Good news :) JavaScript does tend to be a bit horrid.