astrology form with longitude and latitude code

 


add in layout - add gadget- html/javascript paste and save



<!-- HTML form for horoscope input with time zone, longitude, and latitude -->

<form id="horoscopeForm">

  <label>Date of Birth:</label>

  <input type="date" id="dob" /><br />


  <label>Time of Birth:</label>

  <input type="time" id="tob" /><br />


  <label>City:</label>

  <input type="text" id="city" placeholder="Enter city" /><br />


  <label>Country:</label>

  <input type="text" id="country" placeholder="Enter country" /><br />


  <label>Time Zone:</label>

  <select id="timezone">

    <option value="+00:00" />UTC (Coordinated Universal Time)

    <option value="-05:00" />EST (Eastern Standard Time - US & Canada)

    <option value="-08:00" />PST (Pacific Standard Time - US & Canada)

    <option value="+01:00" />CET (Central European Time)

    <option value="+05:30" />IST (India Standard Time)

    <option value="+08:00" />CST (China Standard Time)

    <option value="+09:00" />JST (Japan Standard Time)

    <option value="+10:00" />AEST (Australian Eastern Standard Time)

    <option value="-03:00" />BRT (Brasilia Time - Brazil)

    <option value="+03:00" />MSK (Moscow Standard Time)

    <option value="+02:00" />EET (Eastern European Time)

    <option value="-07:00" />MST (Mountain Standard Time - US & Canada)

    <option value="-06:00" />CST (Central Standard Time - US & Canada)

  </select><br />


  <label>Longitude:</label>

  <input type="number" id="longitude" step="any" readonly /><br />


  <label>Latitude:</label>

  <input type="number" id="latitude" step="any" readonly /><br />


  <!-- Submit button -->

  <input type="submit" value="Analyze Horoscope" />

</form>


<!-- JavaScript logic for geocoding and horoscope analysis using Nominatim API -->

<script>

  const API_URL = 'https://nominatim.openstreetmap.org/search?format=json&addressdetails=1&q=';


  document.getElementById('city').addEventListener('input', function() {

    fetchCoordinates();  // Fetch coordinates when the city changes

  });


  document.getElementById('country').addEventListener('input', function() {

    fetchCoordinates();  // Fetch coordinates when the country changes

  });


  function fetchCoordinates() {

    let city = document.getElementById('city').value;

    let country = document.getElementById('country').value;


    if (city && country) {

      let place = `${city}, ${country}`;


      fetch(API_URL + encodeURIComponent(place))

        .then(response => response.json())

        .then(data => {

          if (data && data.length > 0) {

            let location = data[0];

            document.getElementById('latitude').value = location.lat;

            document.getElementById('longitude').value = location.lon;

          } else {

            alert('No results found for the place entered.');

          }

        })

        .catch(error => {

          alert('Error fetching geocode data: ' + error);

        });

    }

  }


  document.getElementById('horoscopeForm').onsubmit = function(e) {

    e.preventDefault(); // Prevent form from submitting


    // Input values from form

    let dob = document.getElementById('dob').value;

    let tob = document.getElementById('tob').value;

    let city = document.getElementById('city').value;

    let country = document.getElementById('country').value;

    let timezone = document.getElementById('timezone').value;

    let longitude = parseFloat(document.getElementById('longitude').value);

    let latitude = parseFloat(document.getElementById('latitude').value);


    // Placeholder for planetary calculation logic using timezone, longitude, and latitude

    // You can call an API here or implement your own calculation


    // For now, showing a basic result for demo

    let result = "Calculating planetary positions for DOB: " + dob + ", Time: " + tob + 

                 ", Timezone: " + timezone + ", Longitude: " + longitude + ", Latitude: " + latitude;


    // Display result

    alert(result); // Display result in an alert box

  }

</script>


aaaaa







Comments

Popular posts from this blog

KARKA OF HOUSE 2 WORKING GOOD