document.write or DOM?

Discussion in 'JavaScript' started by mcfc4eva, Mar 29, 2009.

  1. #1
    Okay my script take input from the user by them filling out a XHTML form and processes it to create a table of data.

    I realise there is two ways of doing this, by using [document.write] or by using the DOM... but which way is the correct way? (it's for a university assignment so shortcuts aren't acceptable).

    Thanks,
    Mike
     
    mcfc4eva, Mar 29, 2009 IP
  2. xlcho

    xlcho Guest

    Messages:
    532
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Depends on what you need to do. You can use document.write only if you are not going to do (display) anything else on the page. If you do it with DOM you can embed the table inside a page and still have another stuff on it...
     
    xlcho, Mar 30, 2009 IP
    mcfc4eva likes this.
  3. mcfc4eva

    mcfc4eva Well-Known Member

    Messages:
    602
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Excellent, thanks.
    It's not specified to have anything else on the page so I suppose I'll use document.write, it seems a lot easier too.

    Thanks xlcho
     
    mcfc4eva, Mar 30, 2009 IP