Javascript DOM Click event via HTML Attributes

Introduction

Handling Events via HTML Attributes

View in separate window


<!DOCTYPE html> 

<html lang="en"> 
<head> 
    <title>Connecting Events Using HTML Attributes</title> 
</head> /*  ww  w  .j  a va  2  s  .c o m*/
<body> 
    <a href="somepage.html" onclick="return linkClick()">Click Me</a> 
    <script> 
        function linkClick()        { 
            console.log("You Clicked?"); 
            return true; 
        } 
    </script> 
</body> 
</html> 



PreviousNext

Related