1
This function is the final part of my code, it is working correctly, therefore I am not able to get the result in the place where I wish, which is in the div which has a tag with an ID. How do I have the result displayed in this ID?
function DisplayInfo()
{
var expdate = new Date();
var visit;
expdate.setTime(expdate.getTime()+(24 * 60 * 60 * 1000 * 365));
if(!(visit = GetCookie("visit")))
visit = 0;
visit ++ ;
SetCookie("visit", visit, expdate, "/", null, false);
document.write(visit);
}
document.getElementById("count").onload=DisplayInfo();
HTML where to display the result in the correct location:
<div class="col-sm-2 col-4 text-center">
<p id="title_cont">Visitante:</p>
<p id="count" onload="DisplayInfo()"></p>
</div>
with
document.write
will not "write" to the element, use thegetElementById
and then change his content– Ricardo Pontual