Saravanan
Saravanan

Reputation: 231

Content Loading

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??

Upvotes: 0

Views: 106

Answers (3)

Alsciende
Alsciende

Reputation: 26971

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>

Upvotes: 1

Sev
Sev

Reputation: 15709

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

Upvotes: 0

jitter
jitter

Reputation: 54605

Hide the second div via CSS.

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

Upvotes: 1

Related Questions