Código:
<html>
<head>
<title>test</title>
</head>
<body>
<script language="javascript">
var document_head = document.getElementsByTagName("body").item(0);
x = document.createElement("script");
x.setAttribute("language","javascript");
x.setAttribute("type","text/javascript");
a = document.createTextNode("function hola() {alert('hola');} hola();");
x.appendChild(a);
document_head.appendChild(x);
</script>
</body>
</html>
Teoricamente en firefox si me sale el alert que dice hola, pero en internet explorer me dice que es un error desconocido y el debugger para en la linea que dice x.appendChild(a);, alguna idea de como hacer funcionar ese ejemplo en IE? en realidad necesito poder definir un escript completo al vuelo (sin usar src para incluirlo)
Saludos