#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    1
    Rep Power
    0
    I need to change the text in a table cell, or just any text, like
    <SPAN id=iddiv>
    TEXT
    </SPAN>
    I found this
    document.all[id].innerHTML = text
    on this very forum for IE4,
    but the snipet for NS4 I don't get to work:

    document.layers[id].document
    lyr.open()
    lyr.write(text)
    lyr.close()

    What is missing?
    What is the difference using SPAN or DIV?

    Following is the full source,
    thank you for helping,

    *Henning

    <HTML>
    <HEAD>

    <script>
    function WriteIt(id, nestref, text)
    {
    //if(ns4)
    {
    var lyr = document.layers[id].document;
    lyr.open();
    lyr.write(text);
    lyr.close();
    }
    //else if (ie4)
    // document.all[id].innerHTML = text
    }
    </script>

    </HEAD>
    <BODY>

    This is the
    <SPAN id='iddiv'>
    text
    </SPAN>
    .
    <p>
    <a href="javascript:WriteIt('iddiv',null,'NEW TEXT')">go</a>

    </HTML>

    *Henning



    [This message has been edited by grisou (edited May 15, 2000).]
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    Hi Henning - is your <span></span> nested in any other <span>'s or <div>'s if it is you need to tell netscape explicitly where it is ie: if you have a div called <div id=MyDiv> and in it a span called <span id=mySpan>,

    Then to reference MyDiv you would have to use -var lyr = document.MyDiv.document.layers[id].document; // where id=MySpan.

    Hope this is the problem.

    Regards,
    Simon.

    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL

Similar Threads

  1. Replies: 11
    Last Post: February 10th, 2004, 12:03 PM
  2. Parsing text
    By phpfin in forum PHP Development
    Replies: 19
    Last Post: November 28th, 2003, 11:01 AM
  3. CSV data insert to db
    By sujanbob in forum PHP Development
    Replies: 8
    Last Post: July 4th, 2003, 03:56 AM
  4. Multiline REGEX
    By Santos in forum PHP Development
    Replies: 4
    Last Post: December 12th, 2002, 03:59 PM
  5. start text at bottom
    By dusty2k in forum Flash Help
    Replies: 2
    Last Post: February 25th, 2002, 08:44 PM

IMN logo majestic logo threadwatch logo seochat tools logo