Any reason why the following code isn\'t working?
alert(\"1\");
document.head.appendChild(\"
This will do what the original poster wants without creating a new object.
document.head.innerHTML += "";
The script will be appended to the end of the existing head section which may not be what you want.
Believe it or not this will put your script at the start of the head section without erasing the existing head section:
document.head.innerHTML = "" + document.head.innerHTML;