Apoorv singhai Apoorv singhai - 2 years ago 57
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 ?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download