Topic: loading div with javascript? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=30924" title="Pages that link to Topic: loading div with javascript? (Page 1 of 1)" rel="nofollow" >Topic: loading div with javascript? <span class="small">(Page 1 of 1)</span>\

 
nakins
Nervous Wreck (II) Inmate

From:
Insane since: Mar 2006

posted posted 03-20-2009 19:02

Hi,
I'm trying to create the functionality of an iFrame with a div. What I need to do is load / reload a div with a partial html file (no <html> or <body> tags) . The html file always has the same name, it just might change or be added to during a 24 hour period. I understand that I can do something like window.GetElementById(some-Div). innerHTML = "blah blah blah", but what I would like to do (upon initial load) is something like Window.GetElementById(some-div).src = "http://mysite.com/myfile", then, find someway to reload the div when needed.

The reload would occur when a server side script runs that is called from an iframe, and the script writes some javascript code back to the page like parent.window.GetElementById(some-div).reload. BTW, I wanted to use a Div, instead of an iFrame, because the div would expand vertically.

Does this have the slightest chance of working? Any suggestions?

yossiadmon
Obsessive-Compulsive (I) Inmate

From: Israel
Insane since: Sep 2009

posted posted 09-07-2009 10:02

You can do it using prototype library (http://www.prototypejs.org/assets/2008/9/29/prototype-1.6.0.3.js)
The following example will replace the content of specifc div (by id) with the content that will return from the url in the second parameter

code:
new Ajax.Updater('some div id', 'relative url to the page')

reisio
Paranoid (IV) Inmate

From: Florida
Insane since: Mar 2005

posted posted 09-07-2009 18:59

Something lighter and more task-specific here: http://rick.measham.id.au/200606/jif-its-the-new-ajax/

coach
Nervous Wreck (II) Inmate

From:
Insane since: May 2011

posted posted 05-31-2011 11:07
Edit TP: spam removed


Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu