Menu
Hi! I need help with calling a function from document.write. I want to call the function good() by pressing a button in a document created by javascript, but it doesn’t work.
[code]
<html>
<head>
<title>TITLE</title>
<script language =”Javascript”>
function good(){
alert(“good”)
}
function myFunction(){
document.write (“<html><head><title>NEWDOCUMENT</title> </head>”);
document.write (“<body><p><button onclick=’good();’> Good? </button>”);
document.write (“</p></body></html>”);
document.close ();
}
</script>
</head>
<body><p>
<button onclick=”myFunction()”> Call myFunction </button><br />
</p></body>
</html>