var s = document.createElement('SCRIPT'); s.type = 'text/javascript'; s.src = 'http://mydomain.ru/my.php'; document.body.appendChild(s);
<? echo "document.getElementById('myDiv').innerHTML = 'Hello'"; ?>