View Full Version : *Help* editing a div

01-03-2005, 06:25 PM
hey everyone,
i'm a new comer really, so go easy on me....

i'm making a script which flips topics on a news system, using divs so it updates on the page. i'm trying to insert text into a div as this happens.

i've tried using

var ndiv = document.getElementById("newsMain"):
then using

ndiv.document.write("news stuff");

with no result :(
i get an object doesn't support this method error on loading the page

would be grateful for any help,

Willy Duitt
01-03-2005, 06:27 PM
Try ndiv.innerHTML = 'news stuff';

01-03-2005, 06:41 PM
oh wow man, thanks :cool:
i could hug you or buy you a beer... maybe both but i'd probably spill it on your new shirt...

hehe THANK YOU !!! :)
:thumbsup: :thumbsup:

01-03-2005, 06:54 PM
ok one more question, with this can i also put HTML in there too?



nevermind fixed that i think... thanks for your help

01-10-2005, 12:41 AM
yep u can use html while using the innerHTML function just be sure instead of using " use ' if you use quotes it will end the function too soon because the " tells the function when to end, so just have the opening innerHTML quote and the one that ends it so like instead of <img src="yourimage.jpg"> you would do
<img src='yourimage.jpg'>