Discussion :  SOU CS Classes The fastest message board... ever.
Forum for discussion, questions, and replies relating to Web Development I 
Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
Week 9 - Wednesday Discussion
Posted by: harveyd (IP Logged)
Date: November 20, 2007 07:26PM

1. Find an article about recursion. What is an advantage and disadvantage of using this approach?
2. Explain how the setTimeout method works.
3. What are the three types of loops?
4. How are the '{' and '}' characters used for conditions and loops?
5. How do you make an array of images?
6. How do you make an array of dates?
7. Explain how animation in JavaScript works.
8. Explain how you make a scrollable message.
9. Explain how you make a pre-loaded image in JavaScript.
10. How can you change the content of what displays in a web-page?
11. Find a JavaScript that incorporates animation. Explain what it does.
12. What is DHTML?
13. Find a JavaScript that utilizes DHTML. Explain what it does.
14. Find a JavaScript on the Web. Explain what it does.
15. Tell us about an incompatibility between browsers that relates to JavaScript.
16. Tell us something about AJAX that we would find interesting.
17. Find an example of DHTML that we would find interesting

Re: Week 9 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 21, 2007 08:52PM

3. What are the three types of loops?
Pre-test, post-test, counted

4. How are the '{' and '}' characters used for conditions and loops?
The curly braces hold a block of instructions to carry out the condition or loop

5. How do you make an array of images?
Put the different images in [ ], separated by commas

Re: Week 9 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 26, 2007 08:46PM

12. What is DHTML?

DHTML is the combination of HTML and JavaScript.DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more dynamic.DHTML is NOT a scripting language (like JavaScript), but merely a browser feature- or enhancement- that gives your browser the ability to be dynamic.

16. Tell us something about AJAX that we would find interesting.

Ajax is actually a family of technologies that have been available for years. The means to make requests to the server using only JavaScript were built into Internet Explorer 5.5, but the possibilities of the technology were overlooked. It was only in 2005 that the techniques were rediscovered and used.The term Ajax stands for Asynchronous JavaScript And XML.

Re: Week 9 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 27, 2007 04:30PM

3. What are the three types of loops?
pretest,post-test, counter controlled.


8. Explain how you make a scrollable message.

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Home Page</title>
<link href="NALR.css" rel="stylesheet" type="text/css" />

<script language="JavaScript">
var spacer = "... ...", pos = 0, msg;

msg = "I am excited to use this on my own web page. ";
msg += "It will be a way to keep our fans up-to-date ";


function ScrollMessage() {
var newtext = msg.substring(pos, msg.length) +
spacer + msg.substring(0, pos++);

var td = document.getElementById("scroll");
td.innerHTML = newtext;
if (pos > msg.length) pos = 0;
window.setTimeout("ScrollMessage()",200);
}
</script></head>
<body onload="ScrollMessage();">
<h1>A Scrolling Message</h1>
<table border="1"><tr><td id="scroll" width="670px" height="10" ></td></tr></table>
</body></html>

Re: Week 9 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 27, 2007 07:28PM

4. How are the '{' and '}' characters used for conditions and loops?
They group together blocks of code, so the compiler knows that everything inside the { and the } are part of the same block of code

5. How do you make an array of images?
var num=0;
var imageList=new Array(6);
for(num=0;num<6;num++)
imagesList[num]=new Image(90,90);

6. How do you make an array of dates?
var num=0;
var imageList=new Array(6);
for(num=0;num<6;num++)
imagesList[num]=new Date();

7. Explain how animation in JavaScript works.
The idea is that Javascript changes a picture to a different picture /frame, every time a "timer" ticks.

9. Explain how you make a pre-loaded image in JavaScript.
basically you create the Image() variable variable, then do Image().src="pathtoimage" in the head section of the document, to pre load an image.

10. How can you change the content of what displays in a web-page?
you can use the document.write() or document.writeln() to write data to a webpage...

12. What is DHTML?
DHTML is dynamic HTML,
DHTML is a combination of technologies used to create dynamic and interactive Web sites.

To most people DHTML means a combination of HTML, Style Sheets and JavaScript.
(from w3schools)

14. Find a JavaScript on the Web. Explain what it does

// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
if(!radioObj)
return "";
var radioLength = radioObj.length;
if(radioLength == undefined)
if(radioObj.checked)
return radioObj.value;
else
return "";
for(var i = 0; i < radioLength; i++) {
if(radioObj[i].checked) {
return radioObj[i].value;
}
}
return "";
}

// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(radioObj, newValue) {
if(!radioObj)
return;
var radioLength = radioObj.length;
if(radioLength == undefined) {
radioObj.checked = (radioObj.value == newValue.toString());
return;
}
for(var i = 0; i < radioLength; i++) {
radioObj[i].checked = false;
if(radioObj[i].value == newValue.toString()) {
radioObj[i].checked = true;
}
}
}


Bascially what this does it returns the "value" property of the selected checkbox(s), or radio button.

16. Tell us something about AJAX that we would find interesting.
AJAX is open source, and uses a combination of XHTML, and CSS. It also has quite a bit of a client-side script language element to it.


17 & 13. Find an example of DHTML that we would find interesting
[www.dynamicdrive.com]

It's a pong game, built into the web browser.. really really neat.

Re: Week 9 - Wednesday Discussion
Posted by: (IP Logged)
Date: December 03, 2007 05:30AM

8. Explain how you make a scrollable message. <script language="JavaScript">
var spacer = "... ...", pos = 0, msg;

msg = "Welcome. ";
msg += "This was a fun class ";
msg += "I learned alot. ";

function ScrollMessage() {
var newtext = msg.substring(pos, msg.length) +
spacer + msg.substring(0, pos++);

var td = document.getElementById("scroll");
td.innerHTML = newtext;
if (pos > msg.length) pos = 0;
window.setTimeout("ScrollMessage()",200);
}
</script></head>



Sorry, only registered users may post in this forum.
This forum powered by Phorum.