Posts: 876
Name: Matt Pealing
Location: England, north west
|
I have a result that is returned from housingDivAssign () that Im trying to assign to a variable inside the function setEvent ().
However I just get the error "is not a function". Is this because Im using it inside another function?
Code:
function housingDivAssign ()
{
var housingDiv = document.getElementsByTagName ('div');
j = 0
for (i = 0; i < housingDiv.length; i ++)
{
if (housingDiv[i].className == 'housingHide')
{
var housingSection = new Array ();
housingSection[j] = housingDiv[i];
alert (j + ' = ' + housingDiv[i].id);
j ++;
}
}
return housingSection;
}
function housingTitleAssign ()
{
var housingTitle = document.getElementsByTagName ('span');
j = 0
for (i = 0; i < housingTitle.length; i ++)
{
if ((housingTitle[i].className == 'title') || (housingTitle[i].className == 'titleTop'))
{
var housingSectionTitle = new Array ();
housingSectionTitle[j] = housingTitle[i];
// alert (j + ' = ' + housingTitle[i].id);
j ++;
}
}
return housingSectionTitle;
}
function setEvent ()
{
/* for (i = 0; i < housingSectionTitle.length; i ++)
{
alert (housingSectionTitle[i].id);
} */
var housing = housingDivAssign ();
alert (housing[2].id);
}
setEvent ();
|