hello.. im new in javascript.. just started learning actually.. i know the basics and i have a question..
why doesnt this work?
Code:<!DOCTYPE html> <html> <body> <h1>My First JavaScript</h1> <p id="demo" style="color:#000000;"> JavaScript can change the style of an HTML element. </p> <script> function myFunction() { x=document.getElementById('demo') // Find the element if (x.style.match("ff")) { x.style="color:#000000"; } else { x.style="color:#ff0000"; // Change the style } } </script> <button type="button" onclick="myFunction()">Click Me!</button> </body> </html>


Reply With Quote

Bookmarks