CodeLab
Tutorials For Everyone
Run
<!DOCTYPE html> <html> <head> <title>JavaScript Coding Tutorial - TutsInsider</title> <style> .main{ padding: 10px; } .main-heading{ background: #333333; color: #ffffff; padding: 20px; } .main-paragraph{ margin-top: -20px; padding: 20px; box-shadow: inset 0 0 3px 0 #2a73cc; } .main-button{ padding: 5px 10px; border: none; border-radius: 5px; background: #333333; color: #ffffff; box-shadow: 0 0 3px 0 #333333; cursor: pointer; } </style> </head> <body> <div class="main"> <h2 class="main-heading">What Can JavaScript Do?</h2> <div class="main-paragraph" id="demo">JavaScript can interact with HTML markup.</div> <button type="button" id="change-btn" class="main-button">Click Me!</button> </div> <script> function changeHTML(){ document.getElementById("demo").innerHTML = "Hello JavaScript!"; } var x = document.getElementById("change-btn"); x.addEventListener("click", changeHTML); </script> </body> </html>