JavaScript:- on click html event

On click on HTML event




  • The function is separately inserted in the script tag.
  • In this example function name is called on button click.
  • In HTML, JavaScript code we can be inserted between <script> and </script> tags.
  • Scripts can be placed in the <body>, or in the <head> section of an HTML page, or in both.






Code:-



<!DOCTYPE html> 
<html> 
 
<head> 
 <meta name="viewport" content="width=device-width, initial-scale=1"> 
</head> 
 
<body> 
 
 <h1>onClick HTML Event</h1> 
 
 <input onclick="fun_name();" type="button" value="Click Here"> 
 
 <script> 
  function fun_name() 
  { 
   alert("Function Called"); 
  } 
 </script> 
 
</body> 
 
</html>

JavaScript:- on click html event JavaScript:- on click html event Reviewed by Network security on May 27, 2019 Rating: 5

4 comments:

  1. Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. event backdrop

    ReplyDelete
  2. Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. backdrop printing

    ReplyDelete

Useful Information

Powered by Blogger.