Forum Moderators: open
function addRow()
{
var myBody = document.galleryChoice_engine.displayButton;
for (var i=myBody.options.length-1; i >= 0; i--)
{
myBody.remove(0);
}
/*
Here I only want rows to be added if arguments.length is greater than 6.
I don't know how to interate this properly.
*/
for (var i=0, myOption; i < arguments.length; i++)
{
document.images["thumb"+i].src = display[i];
myOption = document.createElement('option');
myBody.appendChild(myOption);
myOption.appendChild(document.createTextNode( arguments[i]) );
myBody.onchange = cell_click;
}
}
Thanks
Mitchell
I figured it out!
Here's what I did:
function addRow()
{
var myBody = document.galleryChoice_engine.displayButton;
// Remove row[0], if present
for (var i=myBody.options.length-1; i >= 0; i--)
{
myBody.remove(0);
}
// Carry on
for (var j=0, myOption; j < arguments.length; j++)
{
document.images["thumb"+j].src = display[j]
}
/* The following is going add rows after 6.
*/
var totalDisplayed = 6;
if (arguments.length > totalDisplayed)
{
document.galleryChoice_engine.className = 'show';
}
for (var i=0, myOption; i + totalDisplayed < arguments.length; i++)
{
myOption = document.createElement('option');
myBody.appendChild(myOption);
myOption.appendChild(document.createTextNode( arguments[i]) );
myBody.onchange = cell_click;
}
}