I am learning javascript,I have got struck with create element.It’s not working in any of the browsers.This is my code:
<body>
<div id="cont">
<script type="text/javascript">
function hi()
{
alert("hi");
}
function replace()
{
var a=document.getElementById('cont');
var b=new Element("form",{name:"pnrForm",action:"\frame.html",method:"post"});
var c=new Element("input",{name:"lccp_trnname",type:"text",id:"lccp_trnname",size:"15",maxlength:"15",alt:"Train Name/Number"});
var d=new Element("input",{type:"image",name:"getIt",src:"button-get-pnr.png",align:"middle"});
b.appendChild(c);
b.appendChild(d);
a.appendChild(b);
}
replace();
hi();
</script>
</div>
</body>
I believe your code is expecting Mootools to be present. Try this:
MooTools is not the DOM and it is also not document.createElement