1.Dynamic content loading in iFrame
HTML: iframe
The concept is simple: create a new
<- iframe/>element and assign a valid url to its src attribute to load html content that isn't initially written into the page.
All you need to do is create a
<- iframe/>element using the DOM createElement() method and add it to the page:
var oIframe = document.createElement("iframe");
oIframe.src = "/path/to/my.html";
oIframe.id = "myUnicId";
oIframe.name = "myIframeName";
document.body.appendChild(oIframe);
Instead, you'll need to have a trigger ( a callback function ) that is the executed at the end of loading HTML file(my.html).
1.1 Simple Example ( Example 1)
The HTML file my.html contains a single line:
Hello world!
DEMO of Example 1
Other Techniques
- Loading XML
- Dynamic Script Loading
- Images and Cookies
No comments:
Post a Comment