Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Assignment:

JavaScript and HTML5


Question 1: Basic HTML Structure
Create an HTML document that includes the basic structure of an HTML page, containing a
heading, a paragraph, and an image. Use appropriate tags to structure the content correctly.

Question 2: Simple JavaScript Function - Calculator


Create an HTML page with input fields for two numbers and buttons for addition, subtraction,
multiplication, and division. Write JavaScript functions to perform the corresponding operations
when the buttons are clicked, and display the result.

Question 3: DOM Manipulation - Color Changer


Create an HTML page with a button and a <div> element. Write a JavaScript function that
changes the background color of the <div> to a randomly generated color when the button is
clicked.

Question 4: Form Validation - Registration Form


Design an HTML registration form with fields for name, email, password, and password
confirmation. Write a JavaScript function to validate that all fields are filled out and that the
password and confirmation match. Display appropriate error messages if validation fails.

Question 5: Working with Arrays - Array Manipulation


Write a JavaScript function that takes an array of numbers as input and does the following:
- Adds a new number to the end of the array.
- Removes the first element from the array.
- Returns the modified array.

Question 6: Shopping List - Add and Remove Items


Create an HTML page with an input field, a "Add Item" button, and a shopping list displayed as
an unordered list (ul). Write JavaScript functions that allow users to add items to the shopping
list when the button is clicked and remove items when clicked on the list.

Question 7: Task List - Task Manager


Design an HTML page with an input field, a "Add Task" button, and a task list displayed as an
ordered list (ol). Write a JavaScript function to add tasks to the task list when the button is
clicked. Users should be able to mark tasks as completed, and completed tasks should have a
line-through style.

*Question 8: To-Do List - Local Storage


Enhance the Task Manager from Question 7 by adding the functionality to store the tasks in the
browser's local storage. When the page is refreshed, the tasks should persist and be displayed.

*Question 9: Image Slider


Create an HTML page with an image element and two buttons labeled "Next" and "Previous."
Write a JavaScript function to change the image source to the next or previous image in an array
when the corresponding button is clicked.

*Question 10: Dynamic Content Addition - Text Generator


Create an HTML page with a button labeled "Generate Text." Write a JavaScript function that
adds a new paragraph element with some randomly generated text inside it every time the button
is clicked.

Question 11: Digital Clock


Design an HTML page to display a digital clock. Write a JavaScript function to update the
clock's time every second.

*Question 12: Password Strength Checker


Create an HTML page with an input field for a password. Write a JavaScript function that checks
the strength of the password and displays a message (e.g., weak, medium, strong) based on the
complexity of the password (consider factors like length, uppercase letters, numbers, special
characters).
* Optional and bonus marks activities
Submission Guidelines:
1. Create a single HTML file with embedded JavaScript for the assignment.
2. Use comments to explain your code where necessary.
3. Ensure the code is well-formatted and indented for readability.
4. Submit the HTML file with your code on the given deadline.
Note: Please understand each question and task thoroughly before attempting to write the code.
The difficulty level is medium, so make sure to use your knowledge of JavaScript and HTML5
effectively.

Good luck with your assignment!

You might also like