Home >
Web Front-end >
HTML Tutorial >
JavaScript - React to events Change HTML content Change HTML styles Write HTML output_html/css_WEB-ITnose
JavaScript - React to events Change HTML content Change HTML styles Write HTML output_html/css_WEB-ITnose
WBOY
Release: 2016-06-24 11:43:39
Original
1297 people have browsed it
React to events
My first Java Script code< /h1>
JavaScript can react to events. For example, click on the button:
Change HTML content
Change html content
head>
My first piece of JavaScript
JavaScript can change the content of HTML elements.
U o _ o U
<script> <br> function myFunction()<br> {<br> x=document.getElementById("demo");//Find element<br> <br> <u> Function MyFunction_1 () <br> {<br> y = document.GetelementByid ("Angel"); <br> y.Innerhtml = "Today is a fun Day! > <br> </script>
Change HTML style
Happy Birthday To You !!!
<script><br> function myfunction()<br> {<br> x=document.getElementById("demo") // Find element <br> x.style.color= "#ff0000"; // Change style <br> }<br> </script>
Write HTML output
🎜>
<script><br> document.write("<h1>This is a heading</h1>");<br> document.write ("<p>This is a paragraph</p>");<br> </script>
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn