Notes: December 10th, 2007

A Recent Quote

"HTML with JavaScript is going to become the GUI technology of choice, killing off 'rich client' and desktop apps written in languages such as C, C++, Java, and C#."

JavaScript

JavaScript affects the behavior of a web page. This allows us to interact with a web page after it is loaded. Many applications that are common are moving aspects of a web page, date and calendar interaction, and effects on web pages. There have been a few different versions of Javascript. This was created by Netscape, which Microsoft jumped on and created JScript. Javascript is not Java, just similar.

Downside

One of the downsides to JavaScript are the security risks. JavaScript allows for popups, tracking, and privacy invasions. Javascript has since been limited, so that it does not have as much control over your system through your web browser.

Using JavaScript

In order to embed JavaScript in a web page you need to make use of the <script> tags. This can be embedded in the heading or body.

<script type="text/javascript">
alert("hello" + new Date() );
</script>

This uses a method call on a window (so can be replaced with window.alert). It allows similar syntax to Java Strings, allowing for + operator concatenation.

<script~>
document.write("<p>hello there, you can write to a document</p>");
</script>

This script allows you to write to the document in order to create dynamic content based on user events. You can also create an entire web page without writing HTML directly.

JavaScript Interpretation

JavaScript is interpreted, not compiled. The language is not compiled at all, but is instead interpreted by the JavaScript engine. Because of this there is no way to compile your code, errors are encountered at runtime. One site that can help figure out errors is JSLint.

Hornick - "Personally I hate this language."