Apoorv singhai Apoorv singhai - 1 year ago 33
HTML Question

Javascript code not showing any alert dialog

<title>BD Home page</title>
div{background-color:green; }
function mf()
Var x=new Date();
alert("Today is: "+x);
<button onclick="mf()">Click</button>
<p>Hello this is html</p>

I am a beginner programmer.In the error code it says
is not defined on line 1:1. I'm not able to understand that.

Is it important to enclose an alert dialog box under a function ?


Use var instead of Var. Javascript var keyword must be simple letters