Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script >
function fun1()
{
document.body.innerHTML= "<input type=button value=clickme1 onclick='fun2()'>";
var code=document.head.script.innerHTML;
code+="function fun2() {document.write('hello'); } ";
document.head.body.script.innerHTML=code;
}
</script >
</head>
<body id="codes">
<input type=button value=clickme onclick="fun1()" />
</body>
</html>
i want to add a function directly in to the page ...how can it be done
this above progam is not working ...plz help
Comment