SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: script help

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Feb 2001
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am trying to insert some test in the middle of a line using IE and NS. Below are some of the help I have received but they do not work for my purpose.
    I need to place text in between the <span> tag:

    <p>left text<span id="newText" name="newTEXT"> </span>right text</p>

    <html>
    <head>
    <style type="text/css">
    #heading {position:absolute;}
    </style>
    <script language="JavaScript">
    <!--
    function isNS(){
    if (navigator.appName == "Netscape"){
    return true;
    }else{
    return false;
    }
    }

    function display(html){
    if (isNS()){
    document.heading.document.open();
    document.heading.document.write(html);
    document.heading.document.close();
    }else{
    heading.innerText = html;
    }
    }
    //-->
    </script>
    </head>
    <body onload="display('Text Message');return true;">
    <span id="heading" name="heading"></span>
    </body>
    </html>
    --------------------------------------------

    <script language="JavaScript">
    <!--

    var n = (navigator.appName == "Netscape") ? 1:0

    function display(html){
    if (n){
    document.heading.document.open();
    document.heading.document.write(html);
    document.heading.document.close();
    }else{
    heading.innerText = html;
    }
    }
    //-->
    </script>

    --------------------------------
    function display(html){
    if(document.getElementById){
    document.getElementById("heading").innerHTML=html;
    }else if(document.all){
    document.all["heading"].innerHTML=html;
    }else if(document.layers){
    with(document.layers["heading"].document){
    open();write(html);close();
    }}}

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you mean by place, all the examples you gave did that, do you mean you need to be able to view the source code and see the text inside the span tags? Since this is client-side technology your code is already rendered so you can see that it works but you won't be able to see it in the source code. What exactly are you trying to accomplish, give us some more detail.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Member
    Join Date
    Feb 2001
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am trying to insert text in side a sentence.

    <p>Fill in the <span id="insert" name="insert"> replace this text with 'missing' </span> word.</p>

    I need to insert the word 'missing'. It works find under IE,
    'document.innerText="missing"' but I do not know how to do it using NS. I will have no idea where the text will end up in the document. The examples I have given us CSS, '#insert {position:absolute;}'.

    I hope this clears up what I am looking for.

    Mark

  4. #4
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Unforutnately, by an large, Netscape 4.x is not capable of this kind of thing. The rendering engine in Netscape 4.x is not capable of reflowing page content, and thus does not support adding/removing/changing content, other than making pre-written floating DIV's appear and disappear by altering their 'visible' CSS property.

    The closest you can get in Netscape 4.x is to dynamically re-write the contents of a DIV tag.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


Bookmarks

Posting Permissions

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