HTML/JS

Items 11 to 20 of 66 total

per page
Page:
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5

Grid  List 

Set Ascending Direction
  1. CIS 273 Week 8 Assignment Single Page Website

    CIS 273 Week 8 Assignment Single Page Website

    Regular Price: $15.00

    Special Price: $12.00

    CIS 273 Week 8 Assignment Single Page Website


    Deliverables: One (1) Web page and one (1) Cascading Style Sheet (.css), including the image file.


    Imagine that you have just started your own freelancing business. You have been hired to create a Web page for a company of your choice that announces the item of the week, month, or year. (e.g., Car of the Year, Pet of the Month, Sandwich of the Week, etc.)


    1. Create a Cascading Style Sheet (.css) that applies a minimum of background color and font.
    2. Create one (1) Web page and a heading tag that overrides the Cascading Style Sheet (.css) font settings and makes the font of the heading different from the rest of the page.
    3. The page must also include:
    a. An image depicting the item of the week, month, or year.
    b. At least three (3) hyperlinks to Websites of associated interest to the item and a brief description of what they are about.
    Example: Click here to visit Strayer University
    This link will take you to the University’s main page where you can find further information.
    4. At the bottom of the page, create a link that would allow the user to email you with questions using the mailto: tag and your email address.
    Note: When the email opens the subject line should automatically say, "More Information Please".
    5. Create a footer displaying the Copyright symbol (using the character entity reference), the year, and your name.
    Example: © 2012 Mary Smith
    6. Include a piece of JavaScript in the page.


    The specific course learning outcomes associated with this assignment are:
    Describe the structure of the World Wide Web as interconnected hypertext documents.
    Create and validate HTML documents.
    Create presentations using Cascading Style Sheets and DHTML.
    Summarize Web standards in terms of specifications, guidelines, software, and tools.
    Write clearly and concisely about Web design and development using proper writing mechanics and technical style conventions.

    Learn More
  2. CIS 273 Lab Assignment 9 JavaScript

    CIS 273 Lab Assignment 9 JavaScript

    Regular Price: $15.00

    Special Price: $12.00

    CIS 273 Lab Assignment 9 JavaScript


    Deliverable: Two (2) Web pages and one (1) Cascading Style Sheet (.css)


    Follow the directions below to complete Lab Assignment 9:
    1. Create two (2) Web pages describing what is displayed and how.
    2. Create one (1) Cascading Style Sheet (.css) file with background color, font type, and font size, and assign it to both Web pages.
    3. On one Web page, add JavaScript that creates an effect on the whole page. Note: If you use the Internet for JavaScript samples, please use free or open source samples only.
    4. On the other Web page, add JavaScript that does something to the cursor. Note: If you use the Internet for JavaScript samples, please use free or open source samples only.

    Learn More
  3. CIS 273 Lab Assignment 7 Form Page

    CIS 273 Lab Assignment 7 Form Page

    $12.00

    CIS 273 Lab Assignment 7 Form Page


    Deliverables: One (1) Web page and one (1) Cascading Style Sheet (.css)


    Follow the directions below to complete Lab Assignment 7:
    Note: The CGI bin script does not work for us because we do not have a server to run it on.
    Therefore, we will use the code listed here instead of the .js files.


    In order to have the Submit and Cancel buttons clear the fields, put this line in your code:
    After your <head> tag:
    <meta charset="utf-8" />
    And this line after your <body> tag:
    <form id='sampleform' method='post' action='' >
    The above code will help the fields clear without taking you away from the page.


    1. Re-create the Web page with a form, and create a heading that states your name and the purpose of the page. Example: “Mary Smith’s Sample Form Page” states the purpose of the page.
    2. Create an entry field for:
    a. “Name”.
    b. “Street Address”.
    c. “City”.
    d. “State (abbr.)”.
    3. Create the formstxt.css sheet and apply it to the page.
    4. Enter your city and state as the default values for the fields.
    5. Use local tags on the page to override the .ccs and set the size of the font for “Student Information” to 6 pt.
    6. Create the “Submit” and “Cancel” buttons.
    7. Validate that the buttons clear the name and street address when selected.

    Learn More
  4. CIS 273 Lab Assignment 5 Navigation Bars and Repeated Images

    CIS 273 Lab Assignment 5 Navigation Bars and Repeated Images

    Regular Price: $12.00

    Special Price: $10.00

    CIS 273 Lab Assignment 5 Navigation Bars and Repeated Images


    Deliverable: Four (4) Web pages (the home page and three image pages) and four (4) Cascading Style Sheets (.css) (one for each page).


    Follow the directions below to complete Lab Assignment 5:
    1. Create a home page with navigation bar to the three (3) pages with images listed below and a Cascading Style Sheet (.css) for bisque color and Arial text.
    2. Create a "single image" page with a Cascading Style Sheet (.css) for background image, bisque color, and Arial text.
    3. Create a "top line image" page with Cascading Style Sheet (.css) for background image, bisque color, and Arial text.
    4. Create a "left side image" page with a Cascading Style Sheet (.css) for background image, bisque color, and centered Arial text.

    Learn More
  5. CIS 273 Lab Assignment 4 Nested Lists and Cascading Style Sheets with red arial font

    CIS 273 Lab Assignment 4 Nested Lists and Cascading Style Sheets

    Regular Price: $12.00

    Special Price: $10.00

    CIS 273 Lab Assignment 4 Nested Lists and Cascading Style Sheets


    Deliverable: Three (3) Web pages and two (2) Cascading Style Sheets (.css)

    Follow the directions below to complete Lab Assignment 4:
    1. Re-create the sample Web pages listed below with nested ordered lists and nested unordered lists. (This Web page will be reused for each part below). (As shown in Figure 1.)
    2. Create the Web page from number 1 with silver background color set by a Cascading Style Sheet (.css). (As shown in Figure 2.)
    3. Create the Web page from number 1 with silver background color and Comic Sans MS font set by a Cascading Style Sheet (.css). (As shown in Figure 3.)
    4. Re-create the Web page set from number 1 with Silver background color and Comic Sans MS font set by a Cascading Style Sheet (.css). Then, using in-page tags to override the CSS, set only the font of the sentence "Here is an Unordered list with several levels of sub-lists" to red, Arial font (different than the rest of the page). (As shown in Figure 4.)

    Learn More
  6. New Perspectives on HTML, XHTML, and Dynamic HTML Chapter 6 Case Problem 2 Civil War Studies

    New Perspectives on HTML, XHTML, and Dynamic HTML Chapter 6 Case Problem 2 Civil War Studies

    Regular Price: $15.00

    Special Price: $12.00

    New Perspectives on HTML, XHTML, and Dynamic HTML Chapter 6 Case Problem 2 Civil War Studies


    Civil War Studies Adanya Lynne, a professor of military history at Ridgeview State College in Bartlett, Tennessee, has been preparing a series of online quizzes for her students. She has created the basicWeb page design and layout, but has come to you for help in designing the quiz form. She envisions a series of multiple choice questions displayed in a collection of option buttons. Students will be able to click answers on the form and then submit their answers to a CGI script running on theWeb server for their scores. Figure 6-61 shows a preview of the page you’ll create for Professor Lynne.


    Complete the following:
    1. Use your text editor to open the cwquiztxt.htm and qformtxt.css files from the tutorial.06\case2 folder included with your Data Files. Enter your name and the date in the comment section of each file. Save the files as cwquiz.htm and qform.css, respectively.
    2. Go to the cwquiz.htm file in your text editor and insert a link to the qform.css style sheet.
    3. Scroll down the file to the rightColumn div element. Professor Lynne has inserted the 10 questions for the online quiz. Enclose the questions in a form element with the id quizForm. Call the CGI script at http://www.ridgeviewcollmil.edu/quiz using the post method.
    4. Go to the first question and enclose the text of the question in a div element with the class name question.
    5. Enclose the set of answers for the first question within a field set.
    6. Place a label element around each possible answer for the first question. Put the first answer in the class answerA, the second answer in the class answerB, the third answer in the class answerC, and the fourth answer in the class answerD.
    7. Within each of the four labels for the answers to the first question, insert an option button directly before the text of the answer. Assign the ids ans1a, ans1b, ans1c, and ans1d to the four option buttons. Assign the field name question1 to each of the four option buttons. Finally, set the values for the four option buttons to a, b, c, and d.
    8. Associate each of the four labels with a different id. Associate the first label with the ans1a field, the second with ans1b, the third with ans1c, and the fourth with ans1d.
    9. Repeat Steps 4 through 8 for the remaining nine questions in the quiz, with the following changes:
    - Change the ids for the four option buttons to the question number. For example, the ids for the second question are: ans2a, ans2b, ans2c, and ans2d.
    - Change the field name of the four option buttons to the number of the question. For example, the field name for the second question is question2, for the third question is question3, and so forth.
    10. After the last question, insert a div element with the id buttons. Within the element, insert a submit button with the value Submit, a command button with the value Answers, and a reset button with the value Reset.
    11. Save your changes to the file.
    12. Go to the qform.css file in your text editor and add the following styles to the style sheet:
    - Float all elements of the question class on the left margin. Set their widths to 200 pixels and right-align the text. Set the clear style to left so that the element is only displayed when the left margin is clear.
    - Display all field sets as block-level elements floated on the left margin. Set the size of the field sets to 400 pixels wide by 50 pixels high. Add a 20-pixel left margin and a 5-pixel bottom margin. Set the position property to relative. Finally, display the tan.jpg file as the background image for the field sets.
    - Use absolute positioning to place all elements of the answerA class at the coordinates (0, 0), place answerB class elements at the coordinates (200, 0), place answerC class elements at (0, 25), and place answerD class elements at (200, 25).
    - Center the contents of the div element with the buttons id. Set the width to 600 pixels and the top/bottom padding to 10 pixels. Set the left/right padding to 0 pixels.
    - For input elements within the buttons div element, set the width to 100 pixels, set the top/bottom margin to 0 pixels, and set the left/right margin to 10 pixels.
    13. Save your changes to the file and open cwquiz.htm in your Web browser. Verify that the layout and design resemble that shown in Figure 6-61.
    14. Submit your completed files to your instructor.

    Learn More
  7. New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 6 Case 1

    New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 6 Case 1 Sblogger

    Regular Price: $15.00

    Special Price: $12.00

    New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 6 Case 1


    Sblogger Sports enthusiast Steve Lavent is working on a Web site called Sblogger that will contain articles and commentary on the world of sports. He's asked for your help in designing the page on which users can submit their own comments on the articles that Steve posts to his blog. Your job will be to create a prototype for the commentary form, and to include HTML code and CSS styles to help validate user input. A preview of the Web form you'll create is shown in Figure 6-78.


    Complete the following:
    1. In your text editor, open the sblogtxt.htm and commtxt.css files from the tutorial.06\case1 folder included with your Data Files. Enter your name and the date in the comment section of the file. Save the files as sblogger.htm and comments.css, respectively.
    2. Go to the sblogger.htm file in your text editor and review the contents and structure of the document. Link the file to the comments.css style sheet.
    3. Scroll down to the h2 heading title Post Your Comments, and directly below this heading insert a form element with the action www.sblogger/cgi-bin/subcomments using the post method.
    4. Within the form element, create a field set with the name and id commentFS.
    5. Create a label element with the text Username. Within the label element, insert an input box for the username field. Make the field required and add the title Supply your username.
    6. Create a label element with the text E-mail. Within the label element, insert an input box for the email field. Set the data type to email and make the field required. Add the title Supply a valid e-mail address.
    7. Create a label element with the text Password containing an input box for the password field. Set the data type to password and make the field required. Add the title You must provide your password.
    8. Create a label element with the text Comment (500 character limit), placing the parenthetical text on a new line, and within the label element insert a text area box for the commentBox field. Limit the number of characters that can be typed into the text area box to 500 characters.
    9. Add a submit button with the text Submit Comment.
    10. Save your changes to the file and then go to the comments.css file in your text editor. Create style rules for the styles described in the following steps.
    11. Display the field set with a background color of (245, 245, 255). Set the top and bottom margins to 15 pixels and the left and right margins to auto. Add 5 pixels of padding and set the width of the field set to 90%.
    12. Display labels as blocks floated on the left once the left margin is clear of elements. Set the font size to 0.9 em and the width to 100%. Set the top and bottom margins to 5 pixels.
    13. Display input boxes and text area boxes as blocks floated on the right margin. Set the font size to 0.9 em and the width to 55%. Set the left and right margins to 10 pixels. In addition, set the height of text area boxes to 150 pixels.
    14. Display the submit button as a block once both margins are clear. Do not float the submit button. Set the dimensions of the button to 200 pixels wide by 30 pixels high.Set the top and bottom margins to 5 pixels, and the left and right margins to auto.
    15. When input boxes and text area boxes receive the focus, change the background color to the value (225, 225, 240).
    16. When input boxes receive the focus and are valid, change the background color to (225, 240, 225) and display the background image go.png in the bottom-right corner of the box with no tiling. Resize the background image so that it is contained within the input box.
    17. When input boxes receive the focus and are invalid, change the background color to (240, 225, 225) and display the background image stop.png in the bottom-right corner of the box with no tiling. Resize the background image so that it's contained within the input box.
    18. Close the style sheet file, saving your changes.
    19. Open sblogger.htm in your Web browser and test the form. Verify that you cannot leave the username, email, and password fields blank and still submit the form. Also verify that the form is rejected if an invalid e-mail address is submitted in the email field.
    20. If you have access to the Google Chrome browser, test the Web page in that browser and verify that the title text you entered for the input boxes in Steps 5 through 7 is included in the error box supplied by the browser when those input boxes fail the validation test.
    21. Submit your completed files to your instructor, in either printed or electronic form, as requested.

    Learn More
  8. New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 8 Case 1 dessertWeb

    New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 8 Case 1 dessertWeb

    Regular Price: $15.00

    Special Price: $12.00

    New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 8 Case 1 dessertWeb


    dessertWeb Amy Wu has asked for your help in redesigning her Web site, dessertWeb, taking advantage of some of the new CSS3 styles. The dessertWeb Web site is a cooking site for people who want to share dessert recipes and learn about cooking in general. In addition to redesigning the site’s appearance, she wants you to create a print style sheet so that users can easily print out recipes and ingredient lists without having to print the headers, footers, and navigation lists that appear on each Web page. Figure 8-64 shows a preview of the screen version of the page.


    Complete the following:
    1. In your text editor, open the recipetxt.htm and dweffectstxt.css files from the tutorial.08\case1 folder included with your Data Files. Enter your name and the date in the comment section of each file. Save the files as recipe.htm and dweffects.css, respectively.
    2. Go to the dweffects.css file in your text editor. Create a style rule for the body element to add two box shadows. One shadow should be placed on the right edge of the page body with the color value (211, 211, 211) and an opacity of 0.5. Set the horizontal offset to 10 pixels, the vertical offset to 0 pixels, and the blur to 15 pixels. Create the same drop shadow on the left edge of the page body as well.
    3. Apply the following style rules to each list item in the horizontal navigation list of the page header: a) set the background color to the value (224, 238, 238); b) add rounded corners 10 pixels in radius; and c) create two inset box shadows: one white shadow located in the upper-left corner offset 3 pixels in the horizontal and vertical direction with a blur of 2 pixels, and the other, a shadow in the lower-right corner with a color value of (147, 207, 207) offset 5 pixels in the horizontal and vertical direction with a blur of 5 pixels.
    4. Add box shadows to the article element with the following properties: a) create an inset box shadow in the lower-right corner with a color value of (171, 171, 171), offset 15 pixels in the horizontal and vertical direction, and with a blur of 75 pixels; and b) create an external shadow located in the lower-right corner with a color value of (101, 101, 101), offset 5 pixels in the vertical and horizontal direction with a blur of 5 pixels.
    5. Add a horizontal background gradient to the blockquote element with the following properties: a) set the gradient to go from the left to the right starting with the color value (166, 230, 230), having a color stop at the 5% point with a value (231, 231, 231), and ending with the color value (255, 255, 255) 15% of the way across the block quote; b) create the same color gradient using the WebKit gradient() function with a color stop for the middle color occurring at the 33% point; and c) using the Internet Explorer Gradient filter, create a horizontal gradient that starts with the hexadecimal color value DEF4F4 and ends with the value FFFFFF.
    6. Save your changes to the file, and then return to the recipe.htm file in your text editor. Add a link to the dweffects.css style sheet file. Specify that the dwlayout.css and dweffects.css style sheets should be used with screen devices.
    7. Save your changes to the document, and then view the page in your Web browser. Verify that the appearance of the page resembles that shown in Figure 8-64. (Note: If you are using Internet Explorer version 8 or earlier, your page will show only the gradient effect around the block quotes, and the gradient will go from light teal to white.)
    8. Figure 8-65 shows a preview of the printed version of the recipe page, displaying the recipe description and ingredients on the first page and the directions on the second page. In your text editor, open the dwprinttxt.css file from the tutorial.08/case1 folder. Enter your name and the date in the comment section of the file, and then save it as dwprint.css.
    9. Set the page size of the printout to 8.5 3 11 inches in portrait orientation with a margin of 0.5 inch.
    10. Hide the following page elements on the printout: page header, left section, right section, all navigation lists, the aside element, the page footer, the h2 element nested within a heading group, and the last paragraph in the article element.
    11. Set the font size of all h1 headings to 200% with a bottom margin of 0.2 inches. Set the font size of all h2 elements to 150% with a top margin of 0.5 inches.
    12. Set the line height of all list items to 1.5 em.
    13. Set the left margin of all ordered lists to 0.5 inches, displaying a decimal value.
    14. Set a page break to always occur before the last h2 element in the page.
    15. Save your changes to the file, and then return to the recipe.htm file in your text editor. Add a link to the dwprint.css style sheet file, setting the style sheet to be used with a print device.
    16. Save your changes to the document, and then view the printed version of the file or preview the printed version in your Web browser. Verify that the contents and layout resemble that shown in Figure 8-65.
    17. Submit your completed files to your instructor.

    Learn More
  9. New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 14 Case 2 JSWorks

    New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 14 Case 2 JSWorks

    Regular Price: $25.00

    Special Price: $20.00

    New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 14 Case 2 JSWorks


    Data Files needed for this Case Problem: js.css, jslogo.png, modernizr-1.5.js, nodestxt.htm, tree.css, treetxt.js


    JSWorks Jorge Soto is the owner and administrator of JSWorks, a Web site containing JavaScript tutorials, tips, and specialized apps. Jorge is working on a multipage tutorial concerning the creation and use of document nodes. You are helping Jorge maintain his Web site. You've volunteered to work on his Web page that describes the appearance of the document node tree. Jorge would like you to include a node tree that is based on the article he's writing so that visitors to his site can see the complete appearance of the node tree for a sample HTML fragment. Figure 14-67 shows a preview of the Web page you'll complete for Jorge.


    The JavaScript program you'll design will need to use recursion to navigate through the entire structure of Jorge's article. As it proceeds through the article, it will record each element, attribute, and text node and display those nodes in a nested list alongside the article text. The CSS styles for the nested list already have been created for you; your only job will be to generate the HTML code of the nested list. Jorge also wants your code to keep a running count of the total number of nodes, element nodes, attributes, and text nodes, including text nodes containing only white space.
    Complete the following:
    1. Using your text editor, open nodestxt.htm and treetxt.js from the tutorial.14\case2 folder. Enter your name and the date in the comment section, and then save the files as nodes.htm and tree.js, respectively.
    2. Go to the nodes.htm file in your text editor and add a link element to connect the document to the tree.css style sheet. Also add a script element to connect the file to the tree.js JavaScript file.
    3. Take some time to study the contents and structure of the document and then close the file, saving your changes.
    4. Go to the tree.js file in your text editor. Declare the following global variables: nodeCount to keep a running count of all of the nodes in the source document; elemCount to count the element nodes; attCount to count the attribute nodes; textCount to count the text nodes; and wsCount to count the text nodes containing white space only. Set the initial value of all of these variables to 0.
    5. Insert a command to run the setup() function when the page is initially loaded by the browser.
    6. Create the writeElemLI() function. The purpose of this function is to create a single list item for the node tree diagram based on the contents of an element node. The structure of the list item is shown in Figure 14-68.
    The function has two parameters: elemNode, which represents the element node from the source document on which the list item is based, and nestedList, which represents the nested list that the list item will be appended to. Add the following commands to the function:
    a. Create a list item element named liElem containing the text string +--.
    b. Create a span element named spanElem. Set the class attribute of the span element to elemLI. (Hint: Use the className property to set the value of the class attribute.)
    c. Declare a variable named elemText setting its initial value to the text string <elem where elem is the node name of the element specified in the elemNode parameter.
    d. Next you'll examine all of the attribute nodes for the element specified by the elemNode parameter. Create a for loop to go through the nodes in the attributes collection for the elemNode parameter. Each time through the loop increase the value of the nodeCount and attCount variables by 1. Also add the following text string to the value of the elemText variable att='value'
    where att is the node name of the attribute node and value is the node value of the attribute node.
    e. After the for loop completes, append the text string > to the value of the elemText variable.
    f. Create a new text node named elemTextNode containing the text of the elemText variable.
    g. Append elemTextNode to spanElem; append spanElem to liElem; and finally, append liElem to nestedList.
    7. Create the writeTextLI() function. The purpose of this function is to create a single list item for the node tree diagram based on the contents of a text node. The structure of the list item will be one of the two structures shown in Figure 14-69.
    The function has two parameters: textNode, which represents the text node from the source document on which the list item is based, and nestedList, which represents the nested list that the list item will be appended to. Add the following commands to the function:
    a. Create the liElem variable for a list item element node containing the text string +--.
    b. Create the spanElem variable for a span element node.
    c. Store the node value of the textNode parameter in the variable textString.
    d. Jorge has provided a function named isWhiteSpaceNode() to determine whether
    a text node represents white space or not. Call the isWhiteSpaceNode() function using textString as the parameter value.
    e. If the isWhiteSpaceNode() function returns the value true, then: i) increase the value of the wsCount variable by 1; ii) set the class name of spanElem to wsLI; and iii) set the inner HTML of spanElem to the text string #text.
    f. If the isWhiteSpaceNode() function returns the value false, then: i) set the class name of spanElem to textLI; and ii) set the inner HTML of spanElem to the value of the nodeValue property for the textNode parameter.
    g. Append the spanElem node to the liElem node, and then append the liElem node to the nestedList parameter.
    8. Create the makeTree() function. The purpose of this function is to recursively generate all of the nested lists contained in the node tree diagram. The function has two parameters: sourceNode, which represents the current node in the source document being added to the node tree diagram, and nestedList, which represents the nested list in the tree diagram that is being written. Add the following commands to the function:
    a. Increase the value of the nodeCount variable by 1.
    b. Using the nodeType property, determine whether sourceNode represents an element node or a text node. If it represents an element node, increase the value of the elemCount variable by 1 and call the writeElemLI() function using sourceNode and nestedList as parameter values. If it represents a text node, increase the value of the textCount variable by 1 and call the writeTextLI() function using sourceNode and nestedList as parameter values.
    c. Use the childNodes.length property value to determine whether sourceNode contains any child nodes. If it does, then do the following: i) declare the newList variable containing an element node for the ol element; ii) store the text string | in newList; iii) loop through all of the child nodes for sourceNode, and for each child node call the makeTree() function using the child node and newList as the values for the sourceNode and nestedList parameters; and iv) after the loop has finished, append newList to nestedList.
    9. Create the setup() function. The purpose of this function is to set up the node tree diagram and report the results. The function has no parameters. Add the following commands to the function:
    a. Declare the sourceNode variable referencing the article element with the id main in the current document.
    b. Declare the treeBox variable containing an aside element node. Set the id of treeBox to treeBox and set the innerHTML property to h1 Node Tree </h1>.
    c. Declare the newList variable containing an ol element node, and then call the makeTree() function using sourceNode and newList as parameter values.
    d. Append newList as a child of treeBox.
    e. Append treeBox as a child of the section element with the id main.
    f. Using the innerHTML property, display the values of the nodeCount, elemCount, attCount, textCount, and wsCount variables within the span elements whose ids are totalNodes, elemNodes, attNodes, textNodes, and wsNodes, respectively.
    10. Use comments to document your JavaScript code throughout the program.
    11. Save your changes to the file, and then load nodes.htm in your Web browser. Verify that a node tree similar to that shown in Figure 14-67 is displayed alongside Jorge's article, and that the article contains 247 total nodes, 99 element nodes, 8 attribute nodes, and 140 text nodes, of which 56 are white space nodes. (Note: Safari running under iOS may report 57 white space nodes.)
    12. Submit your completed files to your instructor, in either printed or electronic form, as requested.

    Learn More
  10. New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 14 Case 3 Sporting Abstract and Statistical Review

    New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 14 Case 3 Sporting Abstract and Statistical Review

    Regular Price: $25.00

    Special Price: $20.00

    New Perspectives on HTML, CSS, and Dynamic HTML 5th edition Tutorial 14 Case 3 Sporting Abstract and Statistical Review



    Data Files needed for this Case Problem: gradient.png, modernizr-1.5.js, nfltxt.htm, sasr.css, sasrlogo.png, stats.js, table.css, tabletxt.js

     

    Sporting Abstract and Statistical Review Walter Delacreaux is the owner and operator of Sporting Abstract and Statistical Review, a new blog and forum to report on and analyze data from the world of sports. Walter wants to fill his Web site with useful tables that other people who share his enthusiasm for statistics can review and study. He wants these tables to be as interactive as possible. One feature he wants to add to his tables is the ability to sort them in a different order by clicking a column heading. Figure 14-70 shows a preview of the Web page you'll create for Walter.
    Walter has stored statistics about quarterbacks, running backs, wide receivers, kick returners, and punt returners in a set of multidimensional arrays. He also has created design styles for the stats table that he wants to appear on his Web page. Your job will be to write the code that generates the node tree for the Web table, and to provide commands to sort the contents of that table when a user clicks one of the table heading cells. Walter wants the table to be sorted by default in descending order, but users should be able to change the sort direction by clicking the same column heading twice in succession. Walter also has provided buttons to allow users to switch from one category of player to another.
    Complete the following:
    1. Using your text editor, open the nfltxt.htm and tabletxt.js files from the tutorial.14\case3 folder. Enter your name and the date in the comment section of each file, and then save them as nflstats.htm and table.js, respectively.
    2. Take some time to view the contents of the nflstats.htm, table.js, and stats.js files, noting the structure of the HTML document and the global variables and functions in the two JavaScript files.
    3. Return to the nflstats.htm file in your text editor, and then add a link element to connect the file to the table.css style sheet file. Add script elements to connect to the stats.js file followed by the table.js file. Save your changes to the file.
    4. Go to the table.js JavaScript file. Below the comment section, declare the following global variables:
    a. caption, which is used to store the text of the table caption. Set its initial value to the value of the qbStatsCaption variable.
    b. head, which is used to store the array of column headings. Set its initial value to the value of the qbStatsHead variable.
    c. sortIndex, which is used to store the column index of the table column by which the stats table will be sorted. Set its initial value to the value of the qbStatsSort variable.
    d. stats, which is used to store the multidimensional array of player statistics. Set its initial value to the value of the qbStats variable.
    e. sortDown, which is used to indicate whether the table is sorted in descending or ascending order. Set its initial value to true.
    5. Add a command to run the makeStatsTable() function when the page is loaded by the browser.
    6. You’ll create the Web table with separate functions for each part of the table. The first function you’ll create is the createTableCaption() function, which is used to create the structure of the table caption. The function has two parameters, table and caption, which are used for the table element node and the caption text, respectively. Have the function create the element node <caption>caption</caption> where caption is the value of the caption parameter, and then append that element node to the table parameter.
    7. Create the createTableColumns() function. The purpose of this function is to create the structure of the colgroup element. The function has two parameters: table, which represents the table element, and cols, which is an integer containing the number of columns in the column group. Use a for loop to generate the node structure <colgroup> <col /> <col class=”sortColumn” /> <col /> … </colgroup>
    where the number of nested col elements is equal to the value of the cols parameter. Note that Walter wants the column by which the table is sorted to be given the class name sortColumn. Therefore, within your for loop, test each index number to determine whether it equals the sortIndex variable. If it does, add the class attribute to the col element. Append the node structure to the table parameter.
    8. Create the createTableHead() function. The purpose of this function is to write the table header. The function has two parameters: table for the table element and cols for the number of columns in the header. Use a for loop to create the node structure <thead> <tr> <th id=”1sortcolumn”>head[1]</th> <th id=”2sortcolumn”>head[2]</th> … </tr> </thead> where head[1], head[2], etc., are the values from the head array global variable you declared in Step 4. Append the node structure to the table parameter.
    9. Create the createTableFoot() function. The purpose of this function is to write the table footer. The function has two parameters, table and cols, and creates the node structure
    <tfoot> <tr> <th colspan=”cols”> Stats compiled by SASR &copy; 2015. All rights reserved. </th> </tr> </tfoot> where cols is the value of the cols variable. (Hint: You must use the colSpan property to reference the colspan attribute.) Append the node structure to the table parameter.
    10. Create the createTableBody() function. The purpose of this function is to write the rows and columns of the table body. The function has three parameters: table representing the Web table, rows, which contains the integer value of the number of rows in the table body, and cols, which contains the integer value of the number of cells within each table row. Use a nested for loop to generate the node structure <tbody> <tr> <td class=”textCell”>stats[0][0]</td> <td class=”numCell”>stats[0][1]</td> … </tr> <tr> <td class=”numCell”>stats[1][0]</td> … </tr> … </tbody>
    where stats[0][0], stats[0][1], etc., are the values from the stats multidimensional array you declared in Step 4. Note that for each td element, you add a class attribute with the value textCell or numCell based on whether the value displayed in the cell is a number or a text string. Use the isNumeric() function provided in the table.js file to make this determination. Append the node structure to the table parameter.
    11. Create the makeStatsTable() function. The purpose of this function is to sort the statistical values, put the different parts of the table together, and append the table to the Web document. Add the following commands to the function:
    a. Declare a variable named rows equal to the length of the stats array.
    b. Declare a variable named cols equal to the length of the head array.
    c. Use the JavaScript sort method along with the colSort() function to sort the contents of the stats array.
    d. Create a table element named tableElem with the id statsTable.
    e. Call the createTableCaption(), createTableColumns(), createTableHead(), createTableFoot(), and createTableBody() functions using tableElem as the parameter value for the table parameter and caption, rows, and cols as the values for the caption, rows, and cols parameters, respectively, to construct the entire node structure of the Web table.
    f. Declare the statsBox variable, referencing the element in the Web document with the id statsBox.
    g. Replace the first child node of statsBox with the tableElem element node.
    12. Save your changes to the file, and then load nflstats.htm in your Web browser. Verify that the content of the Quarterbacks table is displayed on the page.
    13. Next, you’ll enable users to sort the table by different columns. Return to the table.js file in your text editor. Go to the createTableHead() function. For each th element node generated in your for loop, add an onclick event handler to run the changeDirection() function when clicked.
    14. Create the changeDirection() function. The purpose of this function is to either
    change the sorting direction of the currently selected column, or sort the table by a
    newly selected column. Add the following commands to the function:
    a. Use the parseInt() function to extract the index number from the currently selected column. (Hint: Use the this keyword.)
    b. If the index number is equal to the value of the sortIndex global variable you created in Step 4 (indicating that the user has clicked the current sort column), use the negation operator to change the Boolean value of the global sortDown variable from false to true or from true to false. Otherwise, change the value of the sortIndex variable to the index number of the currently selected column.
    c. Call the makeStatsTable() function to regenerate the statistics table.
    15. Save your changes to the file, and then reload nflstats.htm in your Web browser. Verify that you can change the sorting column by clicking each column heading, and that you can toggle the sorting direction by clicking each column heading in succession.
    16. Next, you’ll enable users to select different statistics tables to view in the Web page. Return to the table.js file in your text editor. Create the changeTable() function with a single parameter: statsCategory. The statsCategory parameter will contain a text string indicating the statistics table to view. Add the following commands to the function:
    a. Use the eval() function to change the values of the global variables caption, head, sortIndex, and stats to the value of the statsCategoryCaption, statsCategoryHead, statsCategorySort, and statsCategory variables, respectively, where statsCategory is the value of the statsCategory parameter.
    b. Change the value of the sortDown global variable to true.
    c. Call the makeStatsTable() function to regenerate the statistics table.
    17. Add informative comments to the code in your file and then close the file, saving your changes.
    18. Return to the nflstats.htm file in your text editor. Locate the input elements for the five table buttons, and then add an onclick attribute to each input button to run the command changeTable(stats) where stats is either qbStats, rbStats, wrStats, krStats, or prStats depending on whether the Quarterbacks, Running Backs, Wide Receivers, Kick Returners, or Punt Returners button is clicked.
    19. Save your changes to the file, and then reload nflstats.htm in your Web browser. Verify that you can load different statistics tables by clicking the five statistical category buttons.
    20. Submit your completed files to your instructor, in either printed or electronic form, as requested.
    Learn More

Items 11 to 20 of 66 total

per page
Page:
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5

Grid  List 

Set Ascending Direction