Jump to content

document.innerHTML question


geudrik

Recommended Posts

function writeCmd()
{
// var div = top.buttonFrame.document.getElementById("buttonList");

for(i=0;i<arrCtr;i++)
{
	top.buttonFrame.document.getElementById('buttonList').innerHTML = '<input type="Button" value="' + buttonTXT[i] + '" id="' + buttonIDS[i] + '" name="' + buttonIDS[i] + '" class="submenu_special" onclick="top.contentFrame.document.forms[0].submit()" /><br />';

}
}

 

So I have a basic function here, and it works... except for one thing...

My arrays have multiple elements, and innerHTML only lets one button get written (the last)... How can I append, vs. replacing with this function?

 

 

Link to comment
https://forums.phpfreaks.com/topic/174474-documentinnerhtml-question/
Share on other sites

function writeCmd()
{
    // var div = top.buttonFrame.document.getElementById("buttonList");
    var htmlText = '';
    for(var i=0; i<arrCtr; i++)
    {
        htmlText += '<input type="Button" value="' + buttonTXT[i] + '" id="' + buttonIDS[i] + '"';
        htmlText += ' name="' + buttonIDS[i] + '" class="submenu_special"';
        htmlText += ' onclick="top.contentFrame.document.forms[0].submit()" /><br />';
    }
    top.buttonFrame.document.getElementById('buttonList').innerHTML = htmlText;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.