Forum Moderators: open

Message Too Old, No Replies

Question on setting div contents

         

Jacob or JaF

9:34 pm on Sep 19, 2006 (gmt 0)

10+ Year Member



How come I can set the contents of a div to a picture and not a text file?

Little_G

9:38 pm on Sep 19, 2006 (gmt 0)

10+ Year Member



Hi,

Could you elaborate a bit please.

Andrew

Jacob or JaF

9:46 pm on Sep 19, 2006 (gmt 0)

10+ Year Member



Maybe this is a HTML question.
I want to do something like this:
document.getElementById('mydiv').innerHTML='<text src="file.txt">';

Little_G

10:11 pm on Sep 19, 2006 (gmt 0)

10+ Year Member



Hi,

Unfortunately there is no mechanism in HTML for including text files like you would an image.
You can however use something like:

document.getElementById('mydiv').innerHTML='<iframe src="file.txt"></iframe>';

OR
Use AJAX techniques, [developer.mozilla.org...]

Andrew

[edited by: Little_G at 10:12 pm (utc) on Sep. 19, 2006]

Jacob or JaF

10:20 pm on Sep 19, 2006 (gmt 0)

10+ Year Member



It does seem easier to draw some text than to draw an image...

I'll use AJAX.

[edited by: Jacob_or_JaF at 10:28 pm (utc) on Sep. 19, 2006]