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 8 - Wednesday Discussion
Posted by: harveyd (IP Logged)
Date: November 12, 2007 07:33PM

1. What is a pop-up window? What is an advantage and disadvantage of pop-ups?
2. Find a web-article on pop-ups and tell us something about it.
3. For a particular type of browser, how are pop-ups disabled?
4. How do you create a pop-up window in JavaScript?
5. Tell us one way to create a rollover message.
6. What does the Math.random() method do? How can this be useful?
7. What does the Math.floor() function do?
8. What are some other methods in the Math class? How can they be useful?
9. What is an array?
10. How can you know how many elements there are in an array?
11. Create an array containing strings "abc," "def," and "ghi".
12. What is a pre-loaded image?
13. Explain conceptually you could implement an on-line quiz in JavaScript.
14. Find a site with an on-line quiz. Tell us about it.
15. Explain the arguments passed to the window.open() method.
16. Explain how the time of day function you put into lab 5 works. It is part of the Power Point slides and on-line lectures.
17. Explain how JavaScript can find the version and type of browser that is executing. Why is this useful?
18. Find an Internet article discussing browser incompatibilities. Tell us something about it.
19. What does NaN mean?
20. When do you need braces ({ and }) in an condition statement?
21. Explain how the JavaSript day of week function that you put into lab 5 works. It is part of the Power Point slides and on-line lectures.
22. Find examples of appropriate uses of condition statements.
23. What other languages use double equals for comparisons?
24. Find a script on-line with comparisons in them. Explain their purpose.
25. Find a JavaScript on-line and explain it, line by line.
26. Find a JavaScript on-line that implements rollovers. How does it differ from how we do it?
27. Find a JavaScript on-line that implements a pop-up window. How does it differ from how we do it?

Re: Week 8 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 13, 2007 02:52AM

3. For a particular type of browser, how are pop-ups disabled?

For Firefox, go to Tools, Options, Content Tab, and check the "Block Pop-up windows" box.

For IE, go to Tools, Options, Privacy Tab, and check the "Block Pop-ups" box on the bottom.

For Opera, go to Tools, Preferences, General Tab, and choose "Block Unwanted Pop-ups" from the drop-down list.

For Netscape, go to Tools, Pop-up Manager, Manage Pop-ups, and Remove All from the list.

Re: Week 8 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 13, 2007 02:56AM

2. Find a web-article on pop-ups and tell us something about it.


[www.dailyherald.com]


This article talks about how annoying pop-ups are preventing people from using the internet for their travel plans.

Re: Week 8 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 13, 2007 09:57PM

4. How do you create a pop-up window in JavaScript?

You can create a PopUp Window using HTML and the TARGET attribute.
But if you are feeling lazy this is a good site that will generate a a pop-up window for you. [javascript.internet.com]

Note from Dan: In JavaScript, you use the window.open method.

19. What does NaN mean?

NaN stands for Not-a-Number, it is a immutable global property,NaN is a special value in JavaScript. You will encounter NaN at runtime when you try to do something like multiply your mother's maiden name by the square root of two.



Edited 1 time(s). Last edit at 11/14/2007 05:01PM by harveyd.

Re: Week 8 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 14, 2007 05:33AM

6. What does the Math.random() method do? How can this be useful?
It creates a number between 0 and 1. It can be used to randomly pick from an array of quotes or pictures to post on the site. Say there are 6 in an array quotes, you could use this code Math.floor(Math.random() * 6) to randomly choose one of the quotes from the array.

7. What does the Math.floor() function do?
It rounds the number down to the next whole number.

Re: Week 8 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 15, 2007 11:16PM

11. Create an array containing strings "abc," "def," and "ghi".

var letters = new Array(3)
letters[0] = "abc,"
letters[1} = "def,"
letters[2] = "ghi"

Or:

var letters = ["abc," , "def," , "ghi"]

Re: Week 8 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 16, 2007 02:16AM

12. What is a pre-loaded image?

Pre-loading images refers to loading images into browser cache prior to displaying them, and is used when you wish certain images to be revealed instantly when called upon (such as in a rollover effect). Use this script to preload any number of images easily.

Re: Week 8 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 20, 2007 04:52AM

1. A pop-up window is a web page that displays in its own page instead of framing into another page. Pop ups are very handy when trying to add additional information to your site without actually leaving your site. For example, you have a website designed to sell something to a customer. You want to keep the prospective customer within your site but also want to provide additional information--simply have the separate information site pop up in its own window--the prospect can then exit out of the pop-up and continue perusing your site until a purchase is made. If the information page was actually created within your site, the prospect would have to hit the back button in order to navigate to the purchase window which is much harder than simply closing out a window.

The advantages is to create a method for information/advertisement without actually leaving the current site. The disadvantage is that pop-ups can be created in excess which will slow down your computer - additionally, they can be viewed as an irritant rather than as useful.

9. an array is a table within JavaScript that data can be pulled from.

Re: Week 8 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 20, 2007 06:15PM

1. What is a pop-up window? What is an advantage and disadvantage of pop-ups?
A pop-up window is a window alert that pops up from the alert(); javascript method. It can be very annoying when running through websites quickly, because it stops all action on a webpage while the popup is running. A pop up can also be a link that opens in a new window with or without user intervention. Those are particularly annoying when you're viewing some webpage and softcore porn pops up and scares the bejesus out of you.

2. Find a web-article on pop-ups and tell us something about it.
3. For a particular type of browser, how are pop-ups disabled?
In firefox, the popups are typically disabled by default, you can enable them for a specific site by adding that site to your list of trusted sites.
4. How do you create a pop-up window in JavaScript?
<A href="javascript: alert('Clicked on link!')">Click here!</a>
5. Tell us one way to create a rollover message.

6. What does the Math.random() method do? How can this be useful?
math.random() pumps out a random number between 0 and 1, it can be extremly useful, especially when you're working with something that needs to be random or unforseen.
7. What does the Math.floor() function do?
math.floor() rounds the any number down to the next whole number, so... 8.1298723 would round down to 8, as would 8.9
8. What are some other methods in the Math class? How can they be useful?
9. What is an array?
An array is a variable which can hold x number of values. a two deminsional array could be looked at as a spreadsheet.
10. How can you know how many elements there are in an array?

Re: Week 8 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 21, 2007 12:20AM

13. Explain conceptually you could implement an on-line quiz in JavaScript.
Simple answer:
Use JavaScript to validate form entries and check if they values correspond to correct answers.

Long answer:
The index page should mostly contain an iframe; JavaScript variables do not exist when the current page closes and using the parent page available for keeping the values is important - especially for a multi-page quiz.

I would create two Arrays for each category of question. 1 array for the questions and 1 array for the answers with the indexes corresponding to each other - the question number equals the answer number. The questions could be generated randomly similar to the way we created a quote of the day in lab 7. A third array would be used to track which form component was using which index from which array. Cookies would probably be a better method for tracking the data.

When the user is done they click on submit which tallies all answers and generates a report

15. Explain the arguments passed to the window.open() method.
window.open() takes 4 String parameters all of which are optional; 2 commas are required and a third comma is needed only if the last parameter is used. The parameters are:
1)The URL to open
2)The name of the window - the window (or frame) with this name will be overwritten, if it exists.
3)Attributes - A string with each attribute separated by a comma - height, width, ... which controls the behavior of the window.
4)Does the page replace the current history location - useful for web pages that have moved.

17. Explain how JavaScript can find the version and type of browser that is executing. Why is this useful?
The navigator object contains information about the client. The appName and appVersion property identify the browser family in use. This is very telling when the answer is "Microsoft Internet Explorer" but, the appName for Firefox (like all non-IE browsers) is Netscape. Dissecting the last field of the userAgent is the real way to determine the real non-IE browser application and version information.

This information can be useful if your web page needs to display differently for IE than for non-IE browsers. Pages can be fine tuned to support the different browsers by changes in the styles and scripting layouts to address color support, font support and like issues. Pages may need to be written differently for the different browsers if the expected features (like media player) are expected.
Writing 2 pages is twice work but less hassle caused by browser incompatibility.

Re: Week 8 - Wednesday Discussion
Posted by: (IP Logged)
Date: November 28, 2007 11:20PM

10. How can you know how many elements there are in an array?

Other than counting them, there is a number in parentheses following the declaration of an array. This number is the number of elements in an array.

Below are two consecutive arrays, the first stores multiple elements in one variable where the number of elements is achieved by counting them, and the second in a traditional declaration of an array with the number of elements in parentheses.

Example:

var num=0

var slideSrc=["images/slide1.jpg", "images/slide2.jpg", "images/slide3.jpg",
"images/slide4.jpg", "images/slide5.jpg"]

var slideShow=new Array(5)
slideShow[0].src=slideSrc[num]
slideShow[1].src=slideSrc[num]
slideShow[2].src=slideSrc[num]
slideShow[3].src=slideSrc[num]
slideShow[4].src=slideSrc[num]

Note from dan: The easiest way is to access the length property in an array object. In the above example, slideSrc.length will have a 5 in it.



Edited 1 time(s). Last edit at 11/29/2007 04:02PM by harveyd.

Re: Week 8 - Wednesday Discussion
Posted by: (IP Logged)
Date: December 02, 2007 09:38PM

1. What is a pop-up window? What is an advantage and disadvantage of pop-ups?
A pop-up window is a window alert that pops up from the alert(); javascript method. Pop-up can create frustration when web surfing.. They can put inappropriate content on your screen.
3. For a particular type of browser, how are pop-ups disabled?
In firefox, the popups are disabled by default, you can enable them for a specific site by adding that site to your list of trusted sites.
6. What does the Math.random() method do? How can this be useful?
math.random() it takes no parameters and generates a random number between 0 and 1 we can use this method to simulate the rolling of a six-sided die by (a ) generating a random number between 0and 1, (b) multiplying it by 6 so that it will then a random number between 0 and 6, (c) using floor() method to truncate the value to the nearest integer, which will be 0,1,2,3,4, or 5, and (d) adding 1, yielding a final value of 1,2,3,4,5, or 6.
7. What does the Math.floor() function do?
math.floor() rounds the any number down to the next whole number,

9. What is an array?
An array is an ordered collection of data.



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