0% found this document useful (0 votes)
7 views

script.js

Uploaded by

Shubham Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

script.js

Uploaded by

Shubham Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

// script.

js
document.addEventListener("DOMContentLoaded", () => {
// Mock real-time data
const energyData = document.getElementById('energyData');
const efficiencyData = document.getElementById('efficiencyData');
const gpsData = document.getElementById('gpsData');

function updateData() {
// Mocked data
energyData.textContent = (Math.random() * 500).toFixed(2) + ' kWh';
efficiencyData.textContent = (Math.random() * 100).toFixed(2) + '%';
gpsData.textContent = `Latitude: ${(Math.random() * 180 - 90).toFixed(6)},
Longitude: ${(Math.random() * 360 - 180).toFixed(6)}`;
}

// Update data every 5 seconds


setInterval(updateData, 5000);
});

// Handle login (mock login functionality)


const loginForm = document.getElementById('loginForm');
loginForm.addEventListener('submit', function(e) {
e.preventDefault();
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;

if (email === '[email protected]' && password === 'password123') {


alert('Login successful!');
} else {
alert('Invalid credentials.');
}
});

You might also like