Display an alert error with php and javascript not working properly in FF and Chrome -


i use piece of code inform user fill field in way:

ob_start();   $msg = $_session['erroruser'];  if($msg !=""){     echo '<script type="text/javascript">alert(" ' . $msg . '");</script>'; }  //echo $msg; $_session['erroruser']  = "";                  ob_end_flush(); 

this works in internet explorer while in ff , chrome. msg displayed, have nothing in background, part of page showed (behind message alert).

the problem you're facing outputting alert straight dom cause alert triggered while dom still loading. if you're using jquery should output alert box inside jquery(document).ready callback or otherwise bind load/domcontentready events of window object.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -