PDA

View Full Version : Load a page through javascript and DIV



nelis
10-10-2006, 03:02 PM
Ok I'm using an html page that loads something

Is it possible to call that in a javascript file that puts it to a div tag?

document.getElementById('element1').innerHTML = "page1.html";

or something of that nature.

So clicking a particular javscript link displays the given html page to the element1 div.

djr33
10-10-2006, 09:54 PM
That's called AJAX. (It's an acronym... for something).

It's usually used to make server side pages render in real time... by loading them with javascript, not having the user refresh/visit another page.

I'd advise against it because it isn't particularly compatible.

Using an iframe might work.

However, server side includes (PHP, just SSI, etc.), are likely the best route.

What's the purpose of this?


As for AJAX, if you need that, there's a script called "basic AJAX routine" here you could try, or google will have more info. I haven't done enough with it myself to help. Sorry.

nelis
10-11-2006, 11:28 AM
Well I was basically trying to figure out how to dynamically generate div's.
I have used AJAX quite a bit and could do it that way, although I was looking for an alternative.

For example, I figured out how to do it with image tags.. For instance..

obj.innerHTML = "<img src='picpage.php'>";

This actually generates the image from the php page. With this, I am able to create dynamic graphs and such. I am wanting to do the same thing with just plain text or html.

It would be nice if there was a <text src='file.htm'>

psilos
10-11-2006, 12:05 PM
Check this scripts...http://www.dynamicdrive.com/dynamicindex17/indexb.html

I believe they are all that u want..

Cya...:cool:

nelis
10-11-2006, 02:35 PM
Ahh I found what I needed.. <IFRAME>

it allows you to specify a source page to load from..

thanks man!