Example JavaScript with Onclick Function

Introduction to Javascript Language & Encoding. Examples.

by ITpresent

HTML

<input type="button" value="CLICK HERE" onclick="showImage();"/>
<br>
<img id="img" src="https://itpresent.com/web/html/images/earth.png" style="visibility:hidden"/>


























<br>
<a  href="https://itpresent.com/web/css/box_shadow.php"target="_blank">Javascript Language & Encoding</a>

CSS

img {
  width: 250px;
}
input {
  font-weight: bold;
  color: red;
}

JavaScript

function showImage(){
document.getElementById('img').style.visibility="visible";
}