Fun with Javascript

.JS BUILDING BLOCKS

  • Objects – documents, html tags, images, strings, functions, console – everything!
  • An object is just a special kind of data, with properties and methods.
  • Properties – values associated with an object – color, length, substring
  • Methods – (functions) – VERBS – write, confirm, alert, prompt, log
  • Events – tell Javascript when to execute the code – onclick, onlaod, onmouseover

DOT SYNTAX

  • Javascript is written in dot syntax (sometimes called dot notation).
  • A dot separates the objects, properties and methods within a statement. Here console is the object and log is a method; document is the object and write is the method; document is the object, getElementById is a method and innerHTML is a property:
    • console.log(“Javascript is not so hard!”);
    • document.write(“Boo! You are NOT the only sentence!”);
    • document.getElementById(“demo”).innerHTML = “Hello Dolly”;
  • You can use the Javascript Console in Chrome to test out javascript statements! Go to VIEW-DEVELOPER-JAVASCRIPT CONSOLE

MORE JAVASCRIPT RESOURCES

W3Schools is an excellent introductory Javascript resource, with lots of examples and a complete reference
http://www.w3schools.com/js/js_intro.asp

A series of pretty good beginner’s exercises:
http://htmldog.com/guides/javascript/beginner/

Advertisements

This blog is for exploring new models of journalism using technology and community participation.

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: