mardi 23 février 2016

How to run if statement from PHP to run JS function

I have a PHP Session variable which can be 0 or 1 and this JS function:

<script type="text/javascript">
<!--
    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
//-->
</script>

I would like this function to be run AUTOMATICALLY as soon as the page is opened only if the PHP Session Variable is = 0. How and where can I create my If statement?

Aucun commentaire:

Enregistrer un commentaire