views:

40

answers:

3

I am creating new Page with two divs.This Page Loading within Iframe.

First Div get contents from Database then load.Second Div contains Save and Cancel Button Only.

At the Time of loading Save and Cancel Button (Second Div) comes first.How to avoid this??

+1  A: 

Hide the second div via CSS.

Then add some javascript which unhiddes the div when the loading from the DB is finished

jitter
A: 

Dynamically load the content using something like JQuery or Prototype to control when and how divs load.

Sev
+1  A: 

Have the first document load the second document when it's ready. With a onload handler on the first document that sets the location of the second iframe.

Let's say your iframes have 2 ids: "iframe1" and "iframe2". You load the database content in iframe1, and an empty page in iframe2.

Here is a sample code for the document loaded in iframe1 :

<html>
<head>
<script>
function init () {
   frameElement.ownerDocument.getElementById("iframe2").contentWindow.location = "/someurl/document2.html";
}
</script>
</head>
<body onload="init()">
<!-- iframe1 content -->
</body>
</html>
Alsciende