<body onload="display('name1'); display('name2');">
where display(param) looks like
Code: Select all
function display(param) {
document.getElementById(param).innerHTML = param;
}
<div id="name1"></div>
<div id="name2"></div>
so that the phrase passed through display() gets put in a div of the same id as the param.
It works fine with just one funtion i.e. <body onload="display('name1');"> but when I use php to dynamically add more display() functions to the onload and divs to the page I get a bunch of crap. Sometimes the name2 gets put in <div id="name1"></div>. Any suggestions?