Note 11 for Web Publishing II

Watch & Read:

A very cool way to use Java Script! (The script uses alert box function and document.write command)

Syntax
Alert Box

<script type="text/javascript">
<!--
alert("Text for Alert ");
//-->
</script>

<script type="text/javascript">
<!--
alert("Welcome to CIS233");
//-->
</script>

Syntax
Prompt

<script type="text/javascript">
<!--
variable declared
variable=prompt("Prompt Text"," ")
//-->
</script>

<script type="text/javascript">
<!--
var Name
Name=prompt("Please enter your name","")
//-->
</script>

Syntax
Document. Write

<script type="text/javascript">
<!--
document.write("Text to Write ");
//-->
</script>

<script type="text/javascript">
<!--
document.write("Welcome to CIS233");
//-->
</script>

JavaScript is an Event Driven Language (something must trigger the script to work)

Event
What it does
onclick: JavaScript starts by clicking (a link, or form boxes)
onload: JavaScript starts after the page or an image has finished loading.
onmouseover: JavaScript starts by the mouse moving over a link
onmouseout: JavaScript starts by the mouse moving off the link
onunload: JavaScript starts after you leave the page.

We will use the onClick event to trigger opening a new window!

Syntax
Pop-up Window
window.open("URL", "target","features","") window.open("http://www.asu.edu","_blank", "width=400, height=400")
Features include dimensions of the window and tool bars

We will create a link
<a href="#" onclick="javascript:window.open('http://www.asu.edu','_blank', 'width=400, height=400')">Link</a>

Make sure you notice the quotes (single vs double) plus the fact the href is #

For an external File place the call in the head : <script type="text/javascript" src="codefile.js" >

Review the following:

Take CIS166 Web Scripting

W3Schools HTML DOM

Web design Guidlines:

1. Keep the file size of the Webpages low (50 KB or less).

2. Keep the interface (Web page) simple.

3. Keep the interface consistent. (Links to other Web page in the same location.)

4. Keep the graphics small (20 KB or less.)

5. Minimize the amount of Web page scrolling. (Assuming a fifteen inch monitor, the maximum amount of information should be limited to three screens worth.)

6. Minimize or eliminate distracting movement (Animation or blinking text) If you use animation, make the animation a link off the Web page

7. Minimize or avoid the use of sound. If you use sound, make the sound a link off the Web page

8. Design the Web page so it can be printed out without wasting paper.

 

Terms you need to Lookup:

Syntax, Object, Event, Property, Method and DOM

Homework:

Create a web page that uses Javascript for delivery of part of the content .

You should be reading Chapters 22 -25

Final Step:

Review in your mind everything we covered in class and remember to cover it again before you go to bed so your mind to process this information while you sleep.