Automatic HTML / javascript popup instead of onclick?

advertisements

So I got this input right now and it works as it should. But I want to create another page with the same popup, but this one should run automaticly instead of onclick. Any tips on how to get it working?

<input type="submit" id="checkin" method="post" action="checkin.php" href = "javascript:void(1)" onclick = "document.getElementById('light1').style.display='block';document.getElementById('fade').style.display='block'" value="Check in">
    <div id="light1" class="white_content">
        <form id="formen" name="myForm" action="checkin.php" method="POST">'
        sAlot of content
        </form>
    </div>


1) write the logic for displaing the popup in script and remove the input tag

  <div id="light1" class="white_content">
        <form id="formen" name="myForm" action="checkin.php" method="POST">'
        sAlot of content
        </form>
  </div>

<script>
    document.getElementById('light1').style.display='block';
    document.getElementById('fade').style.display='block'
</script>

2) Or you can also trigger the click event on input using jquery

<input type="submit" id="checkin" method="post" action="checkin.php" href = "javascript:void(1)" onclick = "document.getElementById('light1').style.display='block';document.getElementById('fade').style.display='block'" value="Check in">
    <div id="light1" class="white_content">
        <form id="formen" name="myForm" action="checkin.php" method="POST">'
        sAlot of content
        </form>
    </div>

 <script>
      $('#checkin').trigger('click');
 </script>