Hi!
I have a php page and the behavior is this:
- the page is opened
- user press on button and than a pop-up is opened
- in the pop-up page the user select a date and press ok
- the pop-up is closed and the main page is refreshed with the new data (this is not ajax)
I want that after the pop-up is closed , a loading message in the main page until the page finish to load. so i tried this but this is not working..
<script type="text/javascript">
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
document.getElementById("loading").style.display="none";
});
</script>
<body id="page" onload="addLoadEvent();">
<span id="loading">Loading Data..</span>
the pop-up:
<script type="text/javascript">
echo 'top.opener.location=\'page2.php?date='.$date2.'\';window.close();';
echo '</script>';
i tried also this code:
window.onload=function()
{
document.getElementById('loading').style.display='none';
}
<span id="loading">Loading Data..</span>
but now "loading date" is presented always. thank you!