Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2005
    Location
    West Midlands, United Kingdom
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy *Help* editing a div

    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.open();
    ndiv.document.write("news stuff");
    ndiv.document.close();


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

    would be grateful for any help,
    Al.

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try ndiv.innerHTML = 'news stuff';

  • #3
    New Coder
    Join Date
    Jan 2005
    Location
    West Midlands, United Kingdom
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh wow man, thanks
    i could hug you or buy you a beer... maybe both but i'd probably spill it on your new shirt...

    hehe THANK YOU !!!

  • #4
    New Coder
    Join Date
    Jan 2005
    Location
    West Midlands, United Kingdom
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok one more question, with this can i also put HTML in there too?

    thanks,

    Al.

    *edit*
    nevermind fixed that i think... thanks for your help
    Last edited by mr_Al; 01-03-2005 at 05:59 PM.

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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'>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •