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

What is the difference between scripting and programming?

0 Answers  


What are the main features of javascript?

0 Answers  


Explain promise in javascript?

0 Answers  


Write a way by which you can do something on the close of the window ?

0 Answers  


What is the reason for wrapping the entire content of a javascript source file in a function book?

0 Answers  






What is jscript used for?

0 Answers  


What are the methods of validating whether the form is secure?

1 Answers  


How javascript sort function works?

0 Answers  


Explain escape() in javascript?

0 Answers  


Explain event bubbling and event capturing in javascript?

0 Answers  


How do I open javascript in browser?

0 Answers  


How to redirect a url using JavaScript?

0 Answers  


Categories