Event handler Example



Event handler Example..

Answer / hrpatelsoft@gmail.com

<html>
<head>
<title>DOM!!!</title>
</head>
<body>
<input type="button" id="btnClick" value="Click Me!!" />
<script type="text/javascript">
document.getElementById("btnClick").addEventListener("click", clicked);
function clicked()
{
alert("You clicked me!!!");
}
</script>
</body>
</html>

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JavaScript Interview Questions

Can you pass a anonymous function as an argument to another function?

0 Answers  


Define unescape() and escape() functions?

0 Answers  


What is this? Var myarray = [[[]]];

0 Answers  


Explain function hoisting in javascript?

0 Answers  


What are undefined and undeclared variables?

0 Answers  






How can I learn coding fast?

0 Answers  


Can we create session in javascript?

0 Answers  


What is lazy loading in javascript?

0 Answers  


Can I write javascript in notepad?

0 Answers  


How do I start a javascript project?

0 Answers  


Explain the terms synchronous and asynchronous code?

0 Answers  


What is the difference between write and writeln in javascript?

0 Answers  


Categories