jeudi 16 avril 2015

onload function doesn't work on wordpress template

I'm new on this forum. Let me explain the problem. I created a form generated by the crm I'm using in order to find the form input in the crm. Then I pasted the code on wordpress. It works ok. Then I added a datepicker on some field and tested all of it in local. It still works ok. When I upload all the necessary on wp it doesn't work anymore.


I did some test. Here some of them:


I added the function onload to the body of the template in the file header.php but, even if in the source page there is the onload function, the datepicker doesn't show up.


I tried to write the javascript code inside the page but it doesn't work.


I tried to write < script>function-name()< /script> after the div and it is still working on local but not on wordpress.


I was afraid the problem was that my page couldn't load the file by the relative path so I used the absolute one. Nothing changed.


Eventually I tried to use the absolute path on the local file and it is still working.


The last thing I thought was: My template is ignoring the javascript. But then I realized that in the same page there are 2 other functions and they are working properly.


Here is a bit of code, maybe we can modify that in order to achieve my aim.



<script src="******************/dhtmlxcalendar.js"></script>
<script>
var myCalendar;
function doOnLoad() {
myCalendar = new dhtmlXCalendarObject(["datepickr","CONTACTCF81","datepickr2"]);
}


Thank you in advance to all who'll try to help. DD


Aucun commentaire:

Enregistrer un commentaire