View Full Version : Helo with DIV and IFRAME onload

07-28-2006, 06:24 PM
On our Intranet homepage, I have a layer with an iframe contained in it. The iframe is linked to an html document that is stored in our Content Library system. You have to be authorized to view the documents in Content Library. The problem I'm having is that when you launch the Intranet site, the SSO login screen appears, but it looks like the iframe is trying to launch the html file before the homepage loads. So after you log in, the iframe displays the authentication screen. When you refresh the browser, it then displays the html file because you were authenticated when you logged in. it seems as if the iframe is launching ahead of logging in.

I would like iframe to display after the browser loads. With doing this you should be authenticated and the html page will display. Currently when the body loads, the animation for image links loads. I would like to add the iframe to onload function. This is the code I had prior to editing suggesting I saw online. I have it in BOLD:

<!--#INCLUDE VIRTUAL="/Common/Includes/global.asp"-->


dim ServerName, VUurl, QALBSurl, PRODLBSurl, URL, PromoDoc

ServerName = LCase (Request.ServerVariables("Server_Name"))

VUurl = "/VU/default.asp"
QALBSurl = "/em_uat.html"
PRODLBSurl = "/em_prod.html"

If ServerName = "www.test.gliconline.com" Then
VUurl = "http://" + ServerName + VUurl
URL = "https://" + "www.qa.gliconline.com" + QALBSurl
PromoDoc = "uat017348.html"

ElseIf ServerName = "www.qa.gliconline.com" Then
VUurl = "https://" + ServerName + VUurl
URL = "https://" + ServerName + QALBSurl
PromoDoc = "uat017348.html"

VUurl = "http://" + ServerName + VUurl
URL = "https://" + ServerName + PRODLBSurl
PromoDoc = "015935.html"
End If


<script LANGUAGE="JavaScript">
dynamicanimAttr = "dynamicanimation"
animateElements = new Array()
currentElement = 0
speed = 0
stepsZoom = 8
stepsWord = 8
stepsFly = 12
stepsSpiral = 16
steps = stepsZoom
step = 0
outString = ""
function dynAnimation()
{ Code for the dynamic animation is entered here

<title>Main Page - Right Side</title>


<div id="background" style="position:absolute; left:0; top:0; width:92px; height:90px; z-index:1">
<img src="../images/bluwatermrk.gif">

<!--Promo Box added 7/26/06-->

div style="position: absolute; width: 458px; height: 73px; z-index: 3; left: 75px; top: 10px" id="Promobox">
<iframe name="I1" src="../webdocs/cl_getStellantDoc.asp?DocName=<%=PromoDoc%>" scrolling="no" border="0" frameborder="0" width="448" align="center" height="62" marginwidth="1" marginheight="0"></iframe></div>

<!--<div id="g" style="position:absolute; left:326px; top:221px; width:125px; height:135px; z-index:2">-->
<div id="g" style="position:absolute; left:0px; top:0px; width:125px; height:495px; z-index:2">

<table border=0 cellpadding=0 cellspacing=0 width=615>
<td height=89>&nbsp;</td>
<td align=center colspan=2>
<p ALIGN="center" dynamicanimation="spiral" style="position: relative !important; left: 10000 !important">
<img src="../images/welc_online2.gif" border=0>


<A HREF="../webdocs/cl_ContentLibraryLink.asp?CLLink=GOLWhatsNewResult s.do"
<p ALIGN="left" dynamicanimation="flyBottom" style="position: relative !important; left: 10000 !important">
<IMG BORDER="0" NAME="roll" SRC="../images/whatsnew.gif">


07-28-2006, 07:22 PM
First, a few posting guidlines...

Please enclose your code snippets in
... tags
Try to limit the code to only what the client would see (especially in the client-side forums). The ASP can be distracting and not all people use the same server-side language (eg I use PHP, so the ASP is somewhat foreign). Try running the page and copy the code from the 'View Source' of the browser instead of the actual file.

As to your problem...
Not sure what you were planning to do with the dynAnimation() function; whether this was just a stub for a possible fix to this problem or if it's a completely different function that you want to run at document onload. I'm going to assume it's the latter so that you can see how to implement multiple functions onload...

Have this code inside your <script> tags in the header, perhaps after the dynAnimation() function:

function setIFrame()

window.onload = function() {dynAnimation(); setIFrame();};

You can then remove the onload event from the <body> tag. Also, remove the src attribute from the IFrame; this will be added after the page has loaded. Finally, you'll have to give an id attribute to the IFrame; in the above code, I assumed you'd just give it the same value as its name.

Note that I'm taking your word for granted that loading the IFrame source after the page has load will solve your problem, since I couldn't see anything about logging in, etc. in the code you posted (perhaps not needed to show if you're correct). Also note that the IFrame "box" will still be visible when the page loads, although it may be empty while the IFrame src loads.

07-28-2006, 08:59 PM
Thanks for the tips. I'm new to posting to forum sites. I will go through your suggestion and test it out.

The dynamicanimation function is to have images fly in on the home page, either spiral in, or fly in from the bottom. This function was created long before I took over the code. The images are links to applications.
So right now the body onloads the images with animation.