View Full Version : javascript defined div layers
Suzanne Hodnett
05-23-2003, 03:31 PM
Hi there
Does anyone know whether it is possible to import the contents of a text file or html file into a div layer defined with javascript. I know I can do it with an image ie. using img src = "image.jpg" and I know I can type the text directly into the javascript but I don't want to do that, I actually want to import external text.
I've tried just using src="text.htm" but it doesn't work. Does anyone have any ideas?
Cheers in advance!
Suzanne
Vladdy
05-23-2003, 03:34 PM
I do:
http://www.codingforums.com/showthread.php?s=&threadid=17228
though in your case I would not do it this way....
Suzanne Hodnett
05-23-2003, 03:51 PM
Thanks Vladdy,
The only thing is, it's got a frame around it, and it's also got a white background rather than being just plain text imported into the transparent div layer.
What I'm trying to do is just import some plain text into my div layer which I'm then scrolling using an up and down arrow. What do you think? Is that possible without using the IFrame solid layer?
Suzanne
Vladdy
05-23-2003, 03:56 PM
The only way to import another file is to use frame, iframe or object.
Your other choice is to put the text you want to import in a js string variable and import it as js file:
sometext = 'your text goes here';
neither of the aproaches are acceptable for the general purpose web pages as they rely on javascript to present content making it unaccessible to those who do not have js enabled browsers.
Suzanne Hodnett
05-23-2003, 04:07 PM
ok, so if I used the object approach would it have to be something like a flash file or is there another type of html driven file which could be read under the object approach?
Suzanne
Vladdy
05-23-2003, 04:14 PM
per specification object can be (and should be) used to import any type of content:
http://www.w3.org/TR/html4/struct/objects.html#h-13.3
Browser support though lags behind (damn IE) so for html and text files iframe gives you better chances.
Suzanne Hodnett
05-23-2003, 04:33 PM
Thanks loads Vladdy
I'll read what you've sent me and keep working on it!
Suzanne
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.