geudrik Posted September 16, 2009 Share Posted September 16, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/174474-documentinnerhtml-question/ Share on other sites More sharing options...
Psycho Posted September 17, 2009 Share Posted September 17, 2009 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; } Quote Link to comment https://forums.phpfreaks.com/topic/174474-documentinnerhtml-question/#findComment-919906 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.