All Rounder Tools Blogger-Best blog for blogger: Dividend Calculator tool with colorful styling and all its features use any free library...

Sunday, September 22, 2024

Dividend Calculator tool with colorful styling and all its features use any free library...

 

Dividend Calculator

Dividend Calculator

body { font-family: Arial, sans-serif; background: linear-gradient(135deg, #f8f9fa, #e9ecef); color: #333; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 0 15px rgba(0, 0, 0, 0.2); text-align: center; width: 300px; } h1 { color: #007BFF; } .input-group { margin: 10px 0; } label { display: block; margin-bottom: 5px; } input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 16px; } button { background-color: #28a745; color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; margin-top: 10px; transition: background-color 0.3s; font-size: 16px; } button:hover { background-color: #218838; } .result { margin-top: 20px; } #output { margin-top: 10px; padding: 10px; border: 1px solid #ddd; border-radius: 4px; background: #f9f9f9; } document.getElementById('calculateButton').addEventListener('click', function() { const annualDividend = parseFloat(document.getElementById('annualDividend').value); const stockPrice = parseFloat(document.getElementById('stockPrice').value); const output = document.getElementById('output'); if (isNaN(annualDividend) || isNaN(stockPrice) || stockPrice <= 0) { output.textContent = "Please enter valid values."; return; } const dividendYield = (annualDividend / stockPrice) * 100; output.textContent = `Dividend Yield: ${dividendYield.toFixed(2)}%`; });

No comments:

Post a Comment