From 3cf6f699d97fb034074bff4d69a0226091fc09db Mon Sep 17 00:00:00 2001 From: AsavariShirodkar Date: Sat, 6 Sep 2025 11:53:10 +0530 Subject: [PATCH 1/3] Completed the Distance Converter project --- 1 Distance Converter/convert.html | 17 +++++++++++++++++ 1 Distance Converter/script.js | 30 +++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 1 Distance Converter/convert.html diff --git a/1 Distance Converter/convert.html b/1 Distance Converter/convert.html new file mode 100644 index 0000000..fa551ca --- /dev/null +++ b/1 Distance Converter/convert.html @@ -0,0 +1,17 @@ + + + + + + + +

Distance Converter

+

Enter values for input, fromUnit, and toUnit:

+ Input Value
+ From Unit
+ To Unit

+ + + + + \ No newline at end of file diff --git a/1 Distance Converter/script.js b/1 Distance Converter/script.js index a0aa399..b91e543 100644 --- a/1 Distance Converter/script.js +++ b/1 Distance Converter/script.js @@ -26,4 +26,32 @@ console.log("10 km to m is:", convertDistance(10, 'km', 'm')); // Expected output: 10000 console.log("500 cm to m is:", convertDistance(500, 'cm', 'm')); // Expected output: 5 console.log("2500 m to km is:", convertDistance(2500, 'm', 'km')); // Expected output: 2.5 -*/ \ No newline at end of file +*/ + +function convertDistance(value, fromUnit, toUnit){ + let x = value; + let result = 0; + if (fromUnit == 'km'){ + result = x*1000; + } else{ + if (fromUnit == 'cm'){ + result = x/100; + } else{ + result = x; + } + } + + let finalResult = 0; + if (toUnit == 'km'){ + finalResult = result*1000; + } else{ + if (fromUnit == 'cm'){ + finalResult = result/100; + } else{ + finalResult = result; + } + } + console.log('Result : ' + finalResult); + return finalResult; +} + From addfcce594f62a9c15ced6c3f7c0869e6679b945 Mon Sep 17 00:00:00 2001 From: AsavariShirodkar Date: Sat, 6 Sep 2025 14:56:25 +0530 Subject: [PATCH 2/3] Completed the Digital Clock project --- 2 Digital Clock/clock.html | 14 ++++++++++++++ 2 Digital Clock/script.js | 30 +++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 2 Digital Clock/clock.html diff --git a/2 Digital Clock/clock.html b/2 Digital Clock/clock.html new file mode 100644 index 0000000..cc57e2c --- /dev/null +++ b/2 Digital Clock/clock.html @@ -0,0 +1,14 @@ + + + + + + + +

Digital Clock

+

+ + + + + \ No newline at end of file diff --git a/2 Digital Clock/script.js b/2 Digital Clock/script.js index eee6846..3663a96 100644 --- a/2 Digital Clock/script.js +++ b/2 Digital Clock/script.js @@ -15,4 +15,32 @@ 3. EXECUTION: - Call the time-updating function once immediately to show the time on page load. - Use `setInterval` to automatically call the time-updating function every 1000 milliseconds (1 second). -*/ \ No newline at end of file +*/ + +function CurrentTime(){ + let currentTime = new Date(); + let displayString = ''; + + let hours = currentTime.getHours(); + let minutes = currentTime.getMinutes(); + let seconds = currentTime.getSeconds(); + + if (hours < 10){ + hours = '0' + hours; + } + if (minutes < 10){ + minutes = '0' + minutes; + } + if (seconds < 10){ + seconds = '0' + seconds; + } + + displayString = hours + ':' + minutes + ':' + seconds; + + console.log(displayString); + document.getElementById('clock').innerText = displayString; + return currentTime +} + +setInterval(CurrentTime, 1000); + From 7b46f6b912c3dd489901d232a987268c595d8747 Mon Sep 17 00:00:00 2001 From: AsavariShirodkar Date: Sun, 7 Sep 2025 16:47:07 +0530 Subject: [PATCH 3/3] Completed Color Changer Project and changed some codes --- 1 Distance Converter/convert.html | 4 ++-- 1 Distance Converter/index.html | 16 ++++++++++++++++ 1 Distance Converter/load.html | 6 ++++++ 1 Distance Converter/load.js | 21 +++++++++++++++++++++ 2 Digital Clock/clock.html | 2 -- 3 Color Changer/colorchanger.html | 26 ++++++++++++++++++++++++++ 3 Color Changer/script.js | 16 +++++++++++++++- 5 Calculator/calculator.html | 29 +++++++++++++++++++++++++++++ test.html | 16 ++++++++++++++++ test.js | 8 ++++++++ 10 files changed, 139 insertions(+), 5 deletions(-) create mode 100644 1 Distance Converter/index.html create mode 100644 1 Distance Converter/load.html create mode 100644 1 Distance Converter/load.js create mode 100644 3 Color Changer/colorchanger.html create mode 100644 5 Calculator/calculator.html create mode 100644 test.html create mode 100644 test.js diff --git a/1 Distance Converter/convert.html b/1 Distance Converter/convert.html index fa551ca..31bc159 100644 --- a/1 Distance Converter/convert.html +++ b/1 Distance Converter/convert.html @@ -10,8 +10,8 @@

Distance Converter

Input Value
From Unit
To Unit

- - +
+ \ No newline at end of file diff --git a/1 Distance Converter/index.html b/1 Distance Converter/index.html new file mode 100644 index 0000000..bbde590 --- /dev/null +++ b/1 Distance Converter/index.html @@ -0,0 +1,16 @@ + + + + + + + +

Distance Converter

+

Enter values for input, fromUnit, and toUnit:

+ Input Value
+ From Unit
+ To Unit

+ + + + \ No newline at end of file diff --git a/1 Distance Converter/load.html b/1 Distance Converter/load.html new file mode 100644 index 0000000..98edcd1 --- /dev/null +++ b/1 Distance Converter/load.html @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/1 Distance Converter/load.js b/1 Distance Converter/load.js new file mode 100644 index 0000000..b82c8cd --- /dev/null +++ b/1 Distance Converter/load.js @@ -0,0 +1,21 @@ +document.addEventListener('DOMContentLoaded', function() { + const popupOverlay = document.getElementById('popup-overlay'); + const myPopup = document.getElementById('my-popup'); + const closePopupBtn = document.getElementById('close-popup'); + + // Show the popup and overlay when the page loads + popupOverlay.style.display = 'block'; + myPopup.style.display = 'block'; + + // Hide the popup and overlay when the close button is clicked + closePopupBtn.addEventListener('click', function() { + popupOverlay.style.display = 'none'; + myPopup.style.display = 'none'; + }); + + // Optionally, hide the popup when clicking outside of it (on the overlay) + popupOverlay.addEventListener('click', function() { + popupOverlay.style.display = 'none'; + myPopup.style.display = 'none'; + }); +}); \ No newline at end of file diff --git a/2 Digital Clock/clock.html b/2 Digital Clock/clock.html index cc57e2c..1c064bc 100644 --- a/2 Digital Clock/clock.html +++ b/2 Digital Clock/clock.html @@ -7,8 +7,6 @@

Digital Clock

- - \ No newline at end of file diff --git a/3 Color Changer/colorchanger.html b/3 Color Changer/colorchanger.html new file mode 100644 index 0000000..0f5aa08 --- /dev/null +++ b/3 Color Changer/colorchanger.html @@ -0,0 +1,26 @@ + + + + + Change Background Color + + +

Color Changer

+ + + + + \ No newline at end of file diff --git a/3 Color Changer/script.js b/3 Color Changer/script.js index 690e22b..e3e5ca1 100644 --- a/3 Color Changer/script.js +++ b/3 Color Changer/script.js @@ -13,4 +13,18 @@ - Convert that random number into a hexadecimal string. - Prepend a '#' to the start of the hex string to create a valid CSS color code (e.g., '#1a2b3c'). - Set the `backgroundColor` style of the `body` element to this new random color string. -*/ \ No newline at end of file +*/ + +let button = document.getElementById('changeColorBtn'); + +// Add an event listener to the button +changeColorBtn.addEventListener('click', function() { + let random = Math.floor(Math.random() * 16777215); + let hexadecimal = random.toString(16); + while (hexadecimal.length<6){ + hexadecimal = '0' + hexadecimal; + } + let color = '#' + hexadecimal; + document.body.style.backgroundColor = color; + console.log("Color Changed!"); +}); diff --git a/5 Calculator/calculator.html b/5 Calculator/calculator.html new file mode 100644 index 0000000..cc05cef --- /dev/null +++ b/5 Calculator/calculator.html @@ -0,0 +1,29 @@ + + + + + + + +

Calculator

+
+ +
+ + + + + + + + + + + + +
+
+ + + + \ No newline at end of file diff --git a/test.html b/test.html new file mode 100644 index 0000000..16813df --- /dev/null +++ b/test.html @@ -0,0 +1,16 @@ + + + + + + + +

Distance Converter

+

Enter values for input, fromUnit, and toUnit:

+ Input Value
+ From Unit
+ To Unit

+ + + + \ No newline at end of file diff --git a/test.js b/test.js new file mode 100644 index 0000000..26c92fd --- /dev/null +++ b/test.js @@ -0,0 +1,8 @@ +// Define the JavaScript function + function addData (fn, ln, em) { + + console.log(fn); + console.log(ln); + console.log(em); + + } \ No newline at end of file