how to delete the last line...

Discussion in 'Javascript' started by Mel, Mar 23, 2005.

  1. Mel

    Mel Guest

    i use the following to add a line. how can i delete the last line ?

    oDiv = document.getElementById("MyDiv");
    oDiv.innerHTML = oDiv.innerHTML + string;
     
    Mel, Mar 23, 2005
    #1
    1. Advertising

  2. Mel

    RobG Guest

    Mel wrote:
    > i use the following to add a line. how can i delete the last line ?
    >
    > oDiv = document.getElementById("MyDiv");
    > oDiv.innerHTML = oDiv.innerHTML + string;
    >
    >


    The innerHTML method "specifies or receives the content between
    the start and end tags" of an element.

    <URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/innerhtml.asp>

    // content (text & all markup) replaced by ''
    // which effectively means deleted
    oDiv.innerHTML = '';

    // contents replaced by the value of 'string'
    oDiv.innerHTML = string;

    // contents replaced by text & markup
    oDiv.innerHTML = "Here is a <b>bold</b> word";



    --
    Rob
     
    RobG, Mar 24, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hugo
    Replies:
    10
    Views:
    1,324
    Matt Humphrey
    Oct 18, 2004
  2. sangram
    Replies:
    16
    Views:
    1,992
  3. Johny
    Replies:
    8
    Views:
    394
  4. Richard Schneeman
    Replies:
    16
    Views:
    494
    Daniel Bush
    Aug 27, 2008
  5. Replies:
    10
    Views:
    269
    Robert Klemme
    Oct 11, 2008
Loading...

Share This Page