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

How can you to add javascript to a page when performing an asynchronous postback?

0 Answers  


Name some of the ways in which Type Conversion is possible?

0 Answers  


What is the purpose of 'this' operator in JavaScript?

0 Answers  


Is javascript enabled on chrome?

0 Answers  


What is the difference between an Anonymous Function and a named function?

0 Answers  


Describe the properties of an anonymous function in JavaScript?

0 Answers  


How to get value from a textbox?

0 Answers  


What are disadvantages of using javascript?

0 Answers  


What is an empty html tag?

0 Answers  


Can any one tell me how Java is purely an Oops language

3 Answers  


What is eval() in javascript?

0 Answers  


What is npm repository?

0 Answers  


Categories