ICT581-Assignment 1: Write your first script-Solved

40.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment

Description

Rate this product

                                                

Assignment 1

 In this assignment, you will practice how to manipulate content and visibility filters. You only need materials from lesson 1 and 2 to complete this assignment. Please check the instruction and requirements to complete this assignment.

Instructions

You have a page with its stylesheet (Download the assignment_1_source_files under Assignment 1 module under CONTENT section). There are five buttons under the header element. You only need to create jQuery functions and attach them to these buttons as follows:

  1. Select buttons by their ID names. For example, the first function should select a button by its ID called ‘#add_new_box’ (see the index.html, under the script tag or block).
  2. After selecting a button, we need to fire an event when a button clicked. To do that use a function called ‘.click’ (see the function under ‘// 1. Add new box’ comment).
  3. Now, we need to pass a function to the ‘.click()’. If you follow the three steps, you code should look like this:

Here are the button function details:

  1. Add a box with a default style function:

This button should add a new box to the page layout. The new box will have the default style as showing in the CSS style sheet. The box content should not be the same as the last box created, for example, if the last box content is ‘5’ the new box content should be ‘6’ and so on. So as users keep adding boxes, the content should be updated (see Figure 1 and 2).

JavaScript tips:

You may need to use a mix of JavaScript and jQuery codes to write this function. You may need to use these JavaScript code statements:  variables, addition operations, comparison operations, and conditional statements.

  1. Remove a box function:

Similar to the add button function. Create a function and attach it to the button called ‘Remove a box’. This button should remove the last box in the layout and update the content for the page (see Figure 2 and 1).

JavaScript tips:

You may only need to use JavaScript variables for this function.

 

  1. Add a box with a yellow background function:

This function will add a box to layout but with a different style from the default box’s style. The new box should have a yellow background. Note that the content should be updated the same as the ‘add a new box’ function (see Figure 3). JavaScript tips:

You may need to use a mix of JavaScript and jQuery codes to write this function. You may need to use these JavaScript code statements:  variables, addition operations, comparison operations, and conditional statements.

  1. Order boxes into rows function:

Create a function and attached it to ‘Change page a layout’. This function should sort boxes into rows and change its width to the full width of the page layout (see Figure 4).

JavaScript tips:

You may need to use a mix of JavaScript and jQuery codes to write this function. You may need to use these JavaScript code statements:  variables, addition operations, comparison operations, and conditional statements.

  1. Print a DOM tree function:

Create a function and attach it to the ‘Print DOM tree’ button. This function should only print the DOM tree for boxes area. Each element must be print in single lines. You can format the output as a tree by using dashes. Single ‘-‘mean top element or the root of the tree, then inside element ‘branches’ should start with two dashes ‘- -‘ (optional) (see Figure 5).

Javascript tips:

You may need to use these JavaScript code statements:  variables and addition operations

  • Assignment-1-submission-vwsuxb.zip