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 7 - Friday Discussion
Posted by: harveyd (IP Logged)
Date: November 08, 2007 04:20PM

1. Write a function that displays "hello world" in a pop up.
2. Write a function that writes "hello world" into the web page.
3. Write a function that displays the title of the web-page in a pop up.
4. Create a form with a two text fields and a submit button.
5. Assume there is an html tag <input type="button" id="myButton" value="click here">. What is the javascript statement to print what appears in the value attribute for this button?
6. Display the value of a text field whose name attribute is set to text (name="text"). Assume the text field is in a form whose name attribute is form (name="form").
7. Display the value of a text field whose id attribute is set to data (id="data")
8. Display the "radio checked" if a radio button is checked whose id attribute is set to radioB (id="radioB").
9. Create a drop down menu with four items.
10. Create a form tag that submits the data to an email address.
11. Create a form with three radio buttons.
12. Create a form with three checkboxes.
13. Assume that there is a form with three radio buttons. The name attributes for all three buttons are set to "radioGroup." Write a JavaScript alert message that prints which one the user selected.
14. What are three ways to process an HTML form?
15. Give us an example of CGI.
16. Create a JavaScript variable with the string "abc" in it.
17. Declare a variable, x, with a random number between 0 and 3 in it.
18. Declare a variable, x, with a random number between 3 and 6 in it.
19. Assume that variable x holds the string "abc" and variable "y" holds the string "xyz." Create an alert method that uses concatenation using these variables to output "x = abc and y = xyz".
20. Tell us something interesting about CGI.
21. What are two event attributes (other than onClick)? Tell us what they are for.
22. What does the JavaScript prompt method do?
23. What does the JavaScript confirm method do?
24. What does 'null' mean in JavaScript?
25. Assume that there is a function defined as follows:

function doIt(a, b, c)
{ alert(b + a + c); }

What does doIt("cat","dog","mouse"); output?

26. What does alert("abc\n\'def\'"); output?
27. What is difference between "10"+"20" and 10+20?
28. What does alert(Math.sqrt(25)); print?
29. What does alert(Math.pow(2,3)); print?
30. Suppose we have a function defined as follows:

function doThis(a)
{ return a + 4; }

What does alert(doThis(doThis(3)); print?

31. Create an html tag displaying "pic.jpg" that switches the picture to "newpic.jpg" when the user moves the mouse over the picture. Change it back when the user moves the mouse away from the picture.
32. What is a good discussion topic for future classes?
33. What would be a good lab project?
34. Create a test question that you think would be good to add to either the on-line lecture, for a synthesis question, or for a quiz. Answer your question.
35. What do you wish you knew at the start of the lab project?
36. What suggestions do you have for the on-line lectures, lab projects, power point slides, etc.?
37. What mistakes did you find in the on-line material?

Re: Week 7 - Friday Discussion
Posted by: (IP Logged)
Date: November 13, 2007 12:49AM

1. Write a function that displays "hello world" in a pop up.

<script type="text/javascript">
alert("hello world");
</script>

2. Write a function that writes "hello world" into the web page.

<script type="text/javascript">
document.write("hello world");
</script>

Re: Week 7 - Friday Discussion
Posted by: (IP Logged)
Date: November 14, 2007 05:36AM

26. What does alert("abc\n\'def\'"); output?
abc
def

27. What is difference between "10"+"20" and 10+20?
"10"+"20" 1020
10+20 30

Re: Week 7 - Friday Discussion
Posted by: (IP Logged)
Date: November 15, 2007 10:58PM

25. Assume that there is a function defined as follows:

function doIt(a, b, c)
{ alert(b + a + c); }

What does doIt("cat","dog","mouse"); output?

An alert box will pop-up with the text: "dogcatmouse"

Re: Week 7 - Friday Discussion
Posted by: (IP Logged)
Date: November 16, 2007 02:07AM

12. Create a form with three checkboxes.

<form>
<table>
<tr><td align="center" colspan="3">Which languages do you study in this term?</td>
</tr><tr>
<td>JavaScript<input type="checkbox"
onclick="alert('I study Spanish')" /></td>
<td>HTML<input type="checkbox"
onclick="alert('I study French')"/></td>
<td>XML<input type="checkbox"
onclick="alert('I study German')"/></td>
</tr></table>
</form>

Re: Week 7 - Friday Discussion
Posted by: (IP Logged)
Date: November 16, 2007 03:15AM

17. Declare a variable, x, with a random number between 0 and 3 in it.

var x = Math.floor((Math.random()) * 4);

18. Declare a variable, x, with a random number between 3 and 6 in it.

var x = Math.floor((Math.random()) * 4) + 3;

Re: Week 7 - Friday Discussion
Posted by: (IP Logged)
Date: November 16, 2007 06:42AM

11. Create a form with three radio buttons.

<form id="Beatles_survey" name="Beatles_survey">
Are you a Beatles fan?<br />
Yes <input type="radio" name="beatles" id="beatlesYes" value="yes" /><br />
No <input type="radio" name="beatles" id="beatlesNo" value="no" /><br />
Maybe <input type="radio" name="beatles" id="beatlesMaybe" value="maybe" />
</form>

12. Create a form with three checkboxes.

<form id="interest_survey" name="interest_survey">
Check all areas of interest that apply:</br >
<input type="checkbox" name="theatre" id="theatre" value="yes" /> Theatre<br />
<input type="checkbox" name="music" id="music" value="yes" /> Music<br />
<input type="checkbox" name="poetry" id="poetry" value="yes" /> Poetry<br />
</form>

Re: Week 7 - Friday Discussion
Posted by: (IP Logged)
Date: November 17, 2007 01:28AM

24. What does 'null' mean in JavaScript?
nothing - there is no valid value of any kind associated with the variable. It is useful to in determining if a value was ever set. A value of null means that the user never entered any information; trying to process it could cause problems.

28. What does alert(Math.sqrt(25)); print?
This generates an alert box with the value of 5 - the square root of 25
29. What does alert(Math.pow(2,3)); print?
This generates an alert bot with the value of 8 - 2 raised to the 3rd power

30. Suppose we have a function defined as follows:

function doThis(a)
{ return a + 4; }

What does alert(doThis(doThis(3)); print? 11 - 7 from the first run and 11 from the second

31. Create an html tag displaying "pic.jpg" that switches the picture to "newpic.jpg" when the user moves the mouse over the picture. Change it back when the user moves the mouse away from the picture.
The onmouseover and onmouseout methods execute JavaScript.
<img src="pic.jpg" alt="A picture of some sort" id = "someImage" onmouseover="someImage.src='newpic.jpg';" onmouseout="someImage.src='pic.jpg';" />
The JavaScript code makes the changes without needing a function but, a function provides a lot more flexibility.

Re: Week 7 - Friday Discussion
Posted by: (IP Logged)
Date: December 03, 2007 05:57AM

26. What does alert("abc\n\'def\'"); output?
line one abc
line two def
27. What is difference between "10"+"20" and 10+20?
one displays 10 and20 and the other displays 30



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