I followed this guide for creating a popup div on my front page http://webdesignandsuch.com/how-to-create-a-popup-with-css-and-javascript/
The thing is im not so familiar with coding and i want to put the code in my php file(wordpress site here). I don't know if i can make it work without the tag since my file isnt html so i tried to put pure javascript in it. The css code from the website is in the css style file of my wordpress site and of course the js file is in the folder as well! This is where i got stuck :
<script type="text/javascript" src="css-pop.js"></script>
<script type="text/javascript">
function popup() {
document.getElementById("popUpDiv").style.display = "block";
}
window.onload=function popup();
</script>
<div id="blanket" style="display:none"></div>
<div id="popUpDiv" style="display:none"></div>
Can someone tell me the right code so i can get it working? Thanks!
window.onloadwithin your css-pop.js file.window.onloadonly supports one event of that type, and every time you use it, it will use the most recent occurrence of the event. In your case, if you havewindow.onloadin css-pop.js, it will not work. I suggest using jquery$(document).ready(function(){//code here});or take a look here on how to modifywindow.onloadhtmlgoodies.com/beyond/javascript/article.php/3724571/…