On Github aczietlow / wwp-6
Created by Chris Zietlow / @aczietlow / aczietlow@gmail.com
Sponsored by The Clubhouse
We are quite literally a clubhouse, a dojo even. Members pay dues. We run events and classes, and buy tools based on what our members want and need to build a project, improve themselves, start a business, or give back to the community.
One of the clubs at the club house may interest you. Refresh Augusta are a group of media and web professionals in the Augusta area.
What we're going to cover in this class.
JavaScript is a Scripting Language
You can use javascript to write new elements to your html page.
<script> document.write("<h1>This is a heading</h1>"); document.write("<p>his is a paragraph.</p>"); </script>
Javascript can react to events.
<button type="button" onclick="alert('Welcome!')">Click Me!</button>
Javascript can change content!
x=document.getElementById("demo") //Find the element x.innerHTML="Hello JavaScript"; //Change the content
Let's add some javascript to our page!
<!DOCTYPE html> <html> <body> <p> Using javascript we can write directly to the html document. </p> <script> document.write("<h1>heading</h1>"); document.write("<p>New content</p>"); </script> </body> </html>
document.getElementById("demo").innerHTML="Hello Augusta";
alert("hello world");
document.getElementById("demo").innerHTML="Hello Augusta"; document.getElementById("myDIV").innerHTML="How are you?";
function myFunction() { document.getElementById("demo").innerHTML="Hello Augusta"; document.getElementById("myDIV").innerHTML="How are you?"; }
<!DOCTYPE html> <html> <body> <script> function myFunction() { document.getElementById("demo").innerHTML="Hello Augusta"; document.getElementById("myDIV").innerHTML="How are you?"; } </script> <h1 id="demo">My heading</h1> <div id="myDIV">Insert Content here</div> <button value="click me" onclick="myFunction();">Click Me</button> </body> </html>
<html> <body> <script> function meow() { alert("Cat says meow"); } </script> <img width="150" onclick="meow();" src="http://2.bp.blogspot.com/-wNG9jajTdTk/T9d7gtvm4mI/AAAAAAAANOY/X5eZH3wqkNs/s1600/funny-cat-pictures-part-2-06-13-2012-016.jpg" /> </body> </html>
<html> <body> <script> var date = new Date(); document.getElementById("date").innerHTML=date; </script> <h3 id="date">My heading</h1> </body> </html>