Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 24th, 2008, 03:24 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: colombo, WP, Sri Lanka.
Posts: 481
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default Need iframe loading indicator

hi friends,
Is it possible to show an ajax style indicator when my iframe is getting loaded? i need it urgent. please help me.

surendran
(Anything is Possible)
http://www.suren.info
http://ssuren.spaces.msn.com
__________________
surendran
(Anything is Possible)
http://www.suren.info
http://ssuren.spaces.msn.com
Reply With Quote
  #2 (permalink)  
Old September 24th, 2008, 03:32 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: colombo, WP, Sri Lanka.
Posts: 481
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi,
i found a SOLUTION
put this in the head section

HTML Code:
<script type="text/javascript">

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigat or.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 20 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
    var dyniframe=new Array()
    for (i=0; i<iframeids.length; i++){
        if (document.getElementById){
            resizeIframe(iframeids[i])
        }
        //reveal iframe for lower end browsers? (see var above):
        if ((document.all || document.getElementById) && iframehide=="no"){
            var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
            tempobj.style.display="block"
        }
    }
    document.getElementById('loading').innerHTML = '';
}


function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextr aHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
    if (document.getElementById){
        document.getElementById(iframeid).src=url;
      }
}


if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>and then you need to have a loading.gif image that you want to display

put this code where you want the iframe:

HTML Code:
<div id='loading'><div align="center">Loading...<img src="loading.gif"></div></div>
<iframe id="myframe" src="http://www.yourpagehere.com" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>the center is not needed but makes it look a little better when its being displayed

try it out.... it should work... : )


surendran
(Anything is Possible)
http://www.suren.info
http://ssuren.spaces.msn.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to draw indicator line in owc line chart AlexOo General .NET 0 July 9th, 2007 10:32 PM
values from one iframe to another iframe URGENT raaj Beginning PHP 2 February 27th, 2007 12:19 PM
loading XML Documents in IFrame in IE 5.0 anil_tiwari Javascript 1 February 2nd, 2006 08:01 PM
Problems with loading external pics into an IFrame nancy Classic ASP Databases 2 April 26th, 2005 10:33 AM
Password Security Indicator sridevi Javascript 1 July 24th, 2004 10:12 AM



All times are GMT -4. The time now is 09:22 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.