Construction Dumpster Rental Calculator Logo

Construction Dumpster Rental Calculator

Estimate the cost of renting a dumpster for your construction project.

Local Dumpster Rental Companies

Searching for local companies...
/* styles.css */ body { font-family: Arial, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; line-height: 1.6; } .form-group { margin-bottom: 15px; } label { display: block; margin-bottom: 5px; } input, button { width: 100%; padding: 8px; box-sizing: border-box; } button { background-color: #4CAF50; color: white; border: none; cursor: pointer; margin-top: 10px; } button:hover { background-color: #45a049; } #map { height: 400px; margin-top: 20px; } .error { color: red; } .loading { font-style: italic; color: #666; } .company-card { border: 1px solid #ddd; padding: 10px; margin-bottom: 10px; border-radius: 4px; } // script.js let map; function initMap() { map = new google.maps.Map(document.getElementById('map'), { center: { lat: 40.7128, lng: -74.0060 }, zoom: 11 }); } function calculateCost() { const debris = document.getElementById('debris').value; const zip = document.getElementById('zip').value; const duration = document.getElementById('duration').value; const errorElement = document.getElementById('error'); const resultElement = document.getElementById('result'); errorElement.textContent = ''; resultElement.textContent = ''; if (!debris || !zip || !duration) { errorElement.textContent = 'Please fill in all fields'; return; } if (!/^\d{5}$/.test(zip)) { errorElement.textContent = 'Please enter a valid 5-digit zip code'; return; } const avgPricePerYard = 50; const cost = debris * avgPricePerYard * duration; resultElement.textContent = `Estimated cost: $${cost.toFixed(2)}`; searchRentalCompanies(zip); } function searchRentalCompanies(zip) { const loadingElement = document.getElementById('loadingCompanies'); const companiesContainer = document.getElementById('companiesContainer'); const errorElement = document.getElementById('error'); loadingElement.style.display = 'block'; companiesContainer.innerHTML = ''; errorElement.textContent = ''; const geocoder = new google.maps.Geocoder(); geocoder.geocode({ address: zip }, (results, status) => { if (status === 'OK') { const location = results[0].geometry.location; map.setCenter(location); const service = new google.maps.places.PlacesService(map); service.nearbySearch( { location: location, radius: 24140, keyword: 'dumpster rental' }, (results, status) => { loadingElement.style.display = 'none'; if (status === 'OK') { results.forEach(company => { const card = document.createElement('div'); card.className = 'company-card'; card.innerHTML = `

${company.name}

${company.vicinity}

${company.formatted_phone_number || 'Phone number not available'}

`; companiesContainer.appendChild(card); }); } else { errorElement.textContent = 'No rental companies found in your area. Please try a different zip code.'; } } ); } else { loadingElement.style.display = 'none'; errorElement.textContent = 'Unable to find location. Please check your zip code and try again.'; } }); }