Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

using javascript in process success message

900880Aug 8 2012 — edited Aug 9 2012
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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 6 2012
Added on Aug 8 2012
3 comments
347 views