Call function specific data-role page jquery mobile

Call function specific data-role page jquery mobile

Hello,

I am trying some things with Jquery mobile. I have a few scripts (javascript) in the header that need to be executed on certain pages.
Normally you could use `<body onload="function()">`, but since al the jquery mobile pages are in one HTML page it doens't work. When i try something like this:

  1.     <body onload="function1()"  onload="function2()">

Only the first function works and the second doesn't.
I have a data-role page wich has an Id #checklist and the function in the header is called `function lastVisit()`

How do I get this function to work on this specific page??

This is the whole script in the head:

  1. function lastVisit() {
        var currentDate = new Date(lastTime);
        var afgelopenDatum = new Date(lastTime);
        if(lastTime > 0){
        localStorage.setItem('lastVisit', new Date().getTime());

        var uur = afgelopenDatum.getHours();
        var uur2 = ((uur < 10) ? ":0" : ":") + uur;
        var min = afgelopenDatum.getMinutes();
        var min2 = ((min < 10) ? ":0" : ":") + min;
        var dag = afgelopenDatum.getDate();
        var maand = afgelopenDatum.getMonth()+1;
        var jaar = afgelopenDatum.getFullYear();
        var secondsGeleden = ((currentDate-afgelopenDatum) / 1000);
       
        var pArray = documents.getElementsByClassName("bezoek");

        pArray[0].innerHTML = 'Uw laatste bezoek was om '+ uur2 + min2 + 'uur,' + ' '+ dag + '-' + maand + '-' + jaar;

        }
        else {
        localStorage.setItem('lastVisit', new Date().getTime());
        alert('Eerste bezoek');
        }}























 


And this is the page in HTML:

  
  1. <div data-role="page" id="checklist">
        <div data-role="header" data-position="fixed">
        <h1> Checklist </h1>
        </div>

        <div data-role="content">

        <p class="bezoek"> </p>

        </div>

        <div data-role="footer" data-position="fixed">
        </div>
        </div>













 



So how do i get my page to show what time the last visit was without using the body onload function?