Posts

Showing posts with the label javascript

onblur infinite alert issue fix

Issue: Infinte alert pop up when you use onblur event. This issue have been monitored in Safari, IE. Root Cause: Each time clicking on 'Ok' button of the alert, onblur happens and we are trapped in an infinite loop. Fix: You can refocus the control to different element in the form to get rid off an infinite alert pop up due to onblur  event usage in your application Sample code given below <script type="text/javascript"> function validate() { if(document.getElementById('txtval').value != " ") { alert("not valid value"); document.getElementById('txtint').focus(); } } </script> <form> <input type="text" id="txtval"  name="txtval" onblur="validate();"> <input type="text" name="txtint" id="txtint" > </form> Note:I faced this issue in Safari browser here, but i remember same issue i have been

javascript Div pop up

<style type="text/css">     #popup      {         background-color:#111;         opacity: 0.65;         filter:alpha(opacity=65);         position:absolute;         z-index: 6001;         top:0px;         left:0px;         width:100%;      }     #popUpDiv      {         position:absolute;         background-color:#eeeeee;         width:300px;         height:300px;         z-index: 6002;     }    </style> <script type="text/javascript">     function toggle(div_id)       {           var el = document.getElementById(div_id);           if ( el.style.display == 'none' ) { el.style.display = 'block';}           else {el.style.display = 'none';}       }     function popup_size(popUpDivVar)        {           if (typeof window.innerWidth != 'undefined')            {              viewportheight = window.innerHeight;            }           else            {              viewportheight = doc