diff --git a/Mini-tasks/003-JS-DOM.md b/Mini-tasks/003-JS-DOM.md index 0937998..25ce850 100644 --- a/Mini-tasks/003-JS-DOM.md +++ b/Mini-tasks/003-JS-DOM.md @@ -1,23 +1,384 @@ # JS, DOM Micro Tasks -1. Color a `span/div` element content when a user moves the mouse over the element. +1. Color a `span/div` element content when a user moves the mouse over the element. + + + + + Color Change on Hover + + + -2. Use prompt to read a value from user and display it in the span element. + + + Hover over me! + + + + + + + + + + + + +2. Use prompt to read a value from user and display it in the span element. + + + + + User Input Display + + + + + + + Click to enter text! + + + + + + + + + +3. Display the mouse X and Y coordinates in a `` tag when you click on a `

` tag which contains a paragraph. + + + + + Mouse Coordinates Display + + + + + +

Click here to show mouse coordinates +

This is a paragraph inside the heading.

+

+ + + + + + + + + -3. Display the mouse X and Y coordinates in a `` tag when you click on a `

` tag which contains a paragraph. 4. Write a Javascript code for character counts in the `textarea`. # Example: ![](https://miro.medium.com/max/1600/1*1HI4NXCeCz1EiIWcIE_0iQ.gif) + + + + + + Character Count in Textarea + + + + +
+ +
+ +
Characters: 0
+ + + + + + +5. Convert a given number from decimal to binary or hexadecimal function decimalToBinary(decimalNumber) { + return (decimalNumber >>> 0).toString(2); +} + +// Example usage: +var decimalNumber = 123; // Replace with your decimal number +var binaryNumber = decimalToBinary(decimalNumber); +console.log(`Binary representation of ${decimalNumber}: ${binaryNumber}`); + +function decimalToHexadecimal(decimalNumber) { + return decimalNumber.toString(16).toUpperCase(); +} -5. Convert a given number from decimal to binary or hexadecimal +// Example usage: +var decimalNumber = 123; // Replace with your decimal number +var hexadecimalNumber = decimalToHexadecimal(decimalNumber); +console.log(`Hexadecimal representation of ${decimalNumber}: ${hexadecimalNumber}`); + + +6. With Javascript write a simple from validation + + + + + Simple Form Validation + + + + +

Simple Form Validation Example

+ +
+
+
+

+ +
+
+

+ + +
+ + + + + -6. With Javascript write a simple from validation 7. In your HTML Add two buttons, where first button action for full screen mode and the second button for exit from full screen mode. + + + + + + Fullscreen Mode Toggle + + + + +
+

Fullscreen Mode Toggle Example

+

This is some example content.

+ + + +
+ + + + + + +8. When user press any key in your html page show a alert that `Invalid Key Pressed`, but when user press spacebar show an alert `Thank You..!!` and close the current window. + + + + + Key Press Event Handling + + + +

Press any key to see the alerts

+ + + + + -8. When user press any key in your html page show a alert that `Invalid Key Pressed`, but when user press spacebar show an alert `Thank You..!!` and close the current window. 9. When a cursor is moved over an content, allow the user to edit the content in HTML page.
NOTE: Input element should not be used. + + + + + + Edit Content on Hover + + + + +
+ Hover over this content to edit it. +
+ + + + +