I think this script will help you <html> <head> <title>Loading iframe</title> </head> <script> function loading_iframe(){ document.getElementById('loading_iframe').style.display = "none"; document.getElementById('loading').style.display = ""; document.getElementById('loading_iframe').onload = function(){ document.getElementById('loading').style.display = "none"; document.getElementById('loading_iframe').style.display = ""; } } </script> <body> <iframe id="loading_iframe" src="http://rubensargsyan.com/" width="800" height="600"></iframe> <div id="loading">Loading...</div> </body> <script> loading_iframe(); </script> </html> Code (markup):
here it's my popup code $("CTB_window").innerHTML+="<div id='CTB_title'><div id='CTB_ajaxWindowTitle'>"+j+"</div><div id='CTB_closeAjaxWindow'></div></div><iframe frameborder='0' hspe='0' src='"+urlNoQuery[0]+"&in_smoothbox=true' id='CTB_iframeContent' name='CTB_iframeContent' scrolling='no' style='width:"+(d+29)+"px;height:"+(i+17)+"px;'> </iframe><div class='popupalt'><a href='#' id='CTB_closeWindowButton' title='Close'><img src='http://s.ytimg.com/yt/img/pixel-vfl73.gif' width=1 height=1 border=0 onload='CTB_showWindow()'></a></div>" Code (markup): All i want is to show loading.gif while the iframe is loading