Running a Script from User Action : onClick « Event onMethod « JavaScript DHTML






Running a Script from User Action

   

<html> 
<head> 
<title>An onclick script</title> 
<script type="text/javascript"> 
function alertUser() { 
    document.write("Hi!"); 
} 
</script> 
</head> 
<body> 
Here is some body text. 
<form> 

<input type="text" name="entry"> 

<input type="button" name="oneButton" value="Press Me!" onclick="alertUser()"> 
</form> 
</body> 
</html> 

   
    
    
  








Related examples in the same category

1.'onClick' Example
2.Anchor onclick event
3.Put all your JavaScript statement in onclick clause
4.Add document onclick event handler