Errore JavaScript per php [objeto HTMLParagraphElement]

manoodin

Nuovo Utente
14 Mar 2020
1
0
1
Geolocalizzazione funzione JavaScript per php che dà errore [Htmlparagraphhelement object]

Codice:
<html>
<body>

<p id="siprega"></p>

    <script>

        var notsupported = document.getElementById("siprega");
        if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
        } else {
        notsupported.innerHTML = "Geolocation is not supported by this browser.";
        }
        function showPosition(position) {
        brazil.innerHTML = +position.coords.latitude;
        }
        createCookie("italianofratello", brazil, "1");

        function createCookie(name, value, days) {
        var expires;

        if (days) {
            var date = new Date();
            date.setTime(date.getTime() + (days * 24 * 60 * 60));
            expires = "; expires=" + date.toGMTString();
        } else {
            expires = "";
        }

        document.cookie = escape(name) + "=" +
            escape(value) + expires + "; path=/";
        }
    </script>
    <?php

    $italianofratello = $_COOKIE["italianofratello"];
    echo $italianofratello;
    ?>
    </body>
</html>
 

Discussioni simili