I am using Apex 4.0.2. My goal is to have my success message flash at the top after I succesfully fill out a form. I have a javascript function:
<script type="text/javascript">
{var i = 1,timer;
window.onload=function() {
 timer = setInterval('flash()', 500);
}
function flash() {
if (i<10000) {
if (i%2 == 0) {
document.getElementById('flash').style.backgroundColor = '#ffffff';
} else {
document.getElementById('flash').style.backgroundColor = '#ffff00';
}
} else {
document.getElementById('flash').style.backgroundColor = '#ffffff';
clearInterval(timer);
}
i++;
}
</script>
I placed this code originally on the javascript tab of the page that the form branches to. Later I moved it to the process success message along with the call to the function
<center>
<table id="flash" BORDER=0 >
<tr>
<td>Success!</td>
</tr>
</table>
</center>
I receive an error from the page on Firebug
document.getElementById("flash") is null
document.getElementById('flash').style.backgroundColor = '#ffff00';
Internet Explorer tells me :
Message: Object required
I think my problem is that the success message region object does not always exist. Is there any way to execute the function only when I make that call to display the success message?
In advance,
Thanks so much for your help!