We used some CSS styling to good effect on our home page when preparing our menus. Indicate what value was given to each of the following CSS properties and, in each case, why we chose that value: list-style, float, display, position, and text-decoration.
First of all, list-style was given the value none to remove the bullet markers from an unordered list of menu items. Then float was given the value left so that these list items in a normally vertically-oriented list would “float up” to the left and lie next to each other in a horizontal line to form a menu “strip”. Next, display was given the value block to turn normally-inline links into block elements so they could be given a width, padding and margins (not permitted for inline elements). The position property of the div holding the dropdown menu options was given a value of absolute to remove those options from the normal flow of the page. This, in turn, allowed the following blocks to “rise up” under the horizontal menu and “close up” the space that would otherwise be there. Finally, the text-decoration property of the menu option links (a elements) were given a value of none to remove the default underline used for links.
The critical CSS property: value pair that needs to be set so that we can give the links in our dropdown menu a width is _________________: _________________.
display: block
The JavaScript statement to create a new array of size 10 called x is ___________________________.
x = new Array(10);
Our “dropdown menus” don't actually “drop down”. What happens is that their ________________ property changes from ________________ to ________________.
visibility, hidden, visible
If we want the picture in our picture rotation to change every five seconds, the second parameter of the setInterval() function should be 5.
The getDay() method of the JavaScript Date object returns the string form of the day of the week, such as “Monday”, or “Saturday”.
False
First of all, list-style was given the value none to remove the bullet markers from an unordered list of menu items. Then float was given the value left so that these list items in a normally vertically-oriented list would “float up” to the left and lie next to each other in a horizontal line to form a menu “strip”. Next, display was given the value block to turn normally-inline links into block elements so they could be given a width, padding and margins (not permitted for inline elements). The position property of the div holding the dropdown menu options was given a value of absolute to remove those options from the normal flow of the page. This, in turn, allowed the following blocks to “rise up” under the horizontal menu and “close up” the space that would otherwise be there. Finally, the text-decoration property of the menu option links (a elements) were given a value of none to remove the default underline used for links.
The critical CSS property: value pair that needs to be set so that we can give the links in our dropdown menu a width is _________________: _________________.
display: block
The JavaScript statement to create a new array of size 10 called x is ___________________________.
x = new Array(10);
Our “dropdown menus” don't actually “drop down”. What happens is that their ________________ property changes from ________________ to ________________.
visibility, hidden, visible
If, in a JavaScript switch-statement, the same function call DoIt() is to be made if the case label is any one of the values 2, 3 or 4, then the proper syntax for this part of the switch-statement could be
case 2: case 3: case 4: DoIt(); break;
|
Which one of the following is not a valid method of the JavaScript Date object?
getHour()
If we want to “deactivate” one of the links on a web page, so that clicking on it does not actually take the user anywhere, we can make the value of its href attribute
#
If we have a JavaScript variable that we will be using to hold a reference to a JavaScript object, but that currently has no value, we should assign the variable a temporary value of
null
The picture rotation on our website's home page is started by making our startRotation() function the value of the onload attribute of the body element of that page.
True
If we want a link (that is, the text in an a element) to change color when the mouse “hovers” over it, we use a pseudo-class to style the link accordingly, for which the correct syntax is
a:hover
Convert the following JavaScript code by replacing the switch statement with an equivalent (nested) if-statement :
Month = today.getMonth();
switch (Month)
{
case 0:
case 1:
case 11:
season = "winter";
break;
case 2:
case 3:
case 4:
season = "spring";
break;
case 5:
case 6:
case 7:
season = "summer";
break;
default:
season = "fall";
}
Month = today.getMonth();
switch (Month)
{
case 0:
case 1:
case 11:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
default:
}
Month = today.getMonth();
if(Month == 0 || Month == 1 || Month == 11)
{
season = "winter";
}
else if(Month == 2 || Month == 3 || Month == 4)
{
season = "spring";
}
else if(Month == 5 || Month == 6 || Month == 7)
{
season = "summer";
}
else
{
season = "fall";
}
if(Month == 0 || Month == 1 || Month == 11)
{
season = "winter";
}
else if(Month == 2 || Month == 3 || Month == 4)
{
season = "spring";
}
else if(Month == 5 || Month == 6 || Month == 7)
{
season = "summer";
}
else
{
season = "fall";
}
Our “dropdown menus” don't actually “drop down”. What happens is that their ________________ property changes from ________________ to ________________.
visibility, hidden, visible
JavaScript, unlike languages like traditional C, C++ and Java, can use _____________ as values for the case labels in a switch-statement.
| |
strings
|
What will be the output of the following JavaScript code embedded in an XHTML document body:
for (i = 100; i > 0; i -= 20)
{
document.write(i + " bottles of soda on the wall <br />\ n");
document.write("Take a few down and pass it around<br />\ n");
}
for (i = 100; i > 0; i -= 20)
{
document.write(i + " bottles of soda on the wall <br />\ n");
document.write("Take a few down and pass it around<br />\ n");
}
100 bottles of soda on the wall
Take a few down and pass it around
80 bottles of soda on the wall
Take a few down and pass it around
60 bottles of soda on the wall
Take a few down and pass it around
40 bottles of soda on the wall
Take a few down and pass it around
20 bottles of soda on the wall
Take a few down and pass it around
Take a few down and pass it around
80 bottles of soda on the wall
Take a few down and pass it around
60 bottles of soda on the wall
Take a few down and pass it around
40 bottles of soda on the wall
Take a few down and pass it around
20 bottles of soda on the wall
Take a few down and pass it around
If we want the picture in our picture rotation to change every five seconds, the second parameter of the setInterval() function should be 5.
false
The two event attributes whose values we use to control the hiding and showing of our dropdown menus are onmousein and onmouseout.
false
If, in a JavaScript switch-statement, we want the function DoIt() to be called if any of the values 1, 2 or 3 is matched, the appropriate syntax is this: case 1,2,3: DoIt(); break;
False
The built-in JavaScript function used to control the rotation timing of the images on the home page of our website is
If we want to “deactivate” one of the links on a web page, so that clicking on it does not actually take the user anywhere, we can make the value of its href attribute
#
The structure in which we store our images to prepare for their rotation is called a/an _______
array
array
The getDay() method of the JavaScript Date object returns the string form of the day of the week, such as “Monday”, or “Saturday”.
False
If x is a JavaScript array with 17 elements, the last element is denoted by x[17].
False
False
Which of the following corresponds to the general structure of a JavaScript for-loop?
| |
| for (initialization; condition; update) |
Describe, in pseudocode form, the steps taken by our script that produces the rotating images on our home page.
To produce the rotating images on our home page we proceed as follows:
Determine what day of the week it is
If it is a week day
Build an array of indoor images
else
Build an array of outdoor images (it's a weekend)
Initialize an image counter to zero
Get a reference to the img element on the home page
Set the src attribute of this img element to any one of the images in the array (except
the last one)
Now, every two seconds perform the following steps
Increment the image counter (this is why we shouldn't start with the last image)
Set src attribute of img element to array image given by the image counter
If the image counter has passed the end of the array, reset it to the beginning
To produce the rotating images on our home page we proceed as follows:
Determine what day of the week it is
If it is a week day
Build an array of indoor images
else
Build an array of outdoor images (it's a weekend)
Initialize an image counter to zero
Get a reference to the img element on the home page
Set the src attribute of this img element to any one of the images in the array (except
the last one)
Now, every two seconds perform the following steps
Increment the image counter (this is why we shouldn't start with the last image)
Set src attribute of img element to array image given by the image counter
If the image counter has passed the end of the array, reset it to the beginning
If x is a JavaScript array, the length of that array is given by
x.length
x.length
JavaScript, unlike languages like traditional C, C++ and Java, can use _____________ as values for the case labels in a switch-statement.
strings
strings
Which one of the following JavaScript keywords is not usually used in iteration?
| |
The JavaScript statement Date(); is used to display current date and time. False If today's date is Tuesday, April 17, 2012 and the JavaScript variable today holds a JavaScript Date object representing today's date, then the value returned by the method call today.getDay() is 2 |
If we want the picture in our rotation to change every two seconds, then in the function call that sets up the rotation, the value of the time parameter must be
| |
No comments:
Post a Comment