Esempio di base.
Codice PHP:
<html>
<
head><title>Using more DOM</title>
<
script type="text/javascript">
var 
pimg = new Array('uno0.gif','uno1.gif','uno2.gif');
function 
changeImage()
{
    var 
ran Math.floor(pimg.length Math.random());
    var 
newsImg=document.createElement('img');
    
newsImg.setAttribute("src"pimg[ran]);
    
document.body.appendChild(newsImg);
}
window.onload= function()
{
changeImage();
}
</script>
</head>
<body>
</body>
</html> 



Ps.
Ora hai due snippet