what is javascript used for
What is JavaScript Used for?
The internet houses millions of web pages hosted by websites that serve different purposes. Some attract you while others don't. You like the ones which look good, are easy to use, and interactive enough to engage you for long. This is where Javascript comes into the scene. What is it used for? Let's find out.
<div style="..." onmouseover="color(this, 'red');" onmouseout="uncolor(this)">Red</div><div style="..." onmouseover="color(this, 'green');" onmouseout="uncolor(this)">Green</div><div style="..." onmouseover="color(this, 'blue');" onmouseout="uncolor(this)">Blue</div><script> function color(el, color) { el.style.color = '#FFFFFF'; el.style.backgroundColor = color; } function uncolor(el) { el.style.color = '#000000'; el.style.backgroundColor = '#E6E6E6'; }</script>
<div onclick="alert('Hey you just clicked a button!');">Button</div>