/    Sign up×
Community /Pin to ProfileBookmark

Does Netscape support some equivalent of the <span> tag?

The subject pretty much sums it up. Is there some equivalent (Netscape) tag that I can use to look up an document element and dynamically change it the way I can in IE through a <span>?

Regards,

-Tim

to post a comment
JavaScript

11 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliJun 06.2003 — Netscape?..its a pretty generalized term..Please be specific with the versions...as far as I know...4.6+ and NS6+ all support div and tag...

depends what you are trying to do...
Copy linkTweet thisAlerts:
@TimauthorJun 06.2003 — 

Netscape 4.61 to be precise. What I'm trying to do is replace what's inside the cell of a table. It's easy in IE, I can wrap the <td> elements inside a <span> tag like this:
=================


<html>

<body onLoad="checkBrowser();">

<form method="post">

<script language="JavaScript">

function checkBrowser() {

if (navigator.appName=="Netscape")

document.forms[0].elements['td1'].innerHTML="<td>Netscape</td>";

else

document.forms[0].elements['td1'].innerHTML="<td>Not Netscape</td>";

}

</script>

<table>

<tr>

<span id='td1'><td>Unknown</td></span>

</tr>

</td>

</table>

</form>

</body>

</html>

=================

This works correctly in IE but throws an error in Netscape (and I don't have a javascript debugger).

Regards,

-Tim
Copy linkTweet thisAlerts:
@JHLJun 06.2003 — I don't think Netscape 4.61 support innerHTML.

Never use Netscape 4.61 before but in Netscape 4.7, this is what I will do.

with(document.layers['td1'].document){

open();

write('<td>Not Netscape</td>');

close();

}
Copy linkTweet thisAlerts:
@TimauthorJun 06.2003 — Thanks JHL but what does the HTML look like with the <layer> tag?

Regards,

  • - Tim
  • Copy linkTweet thisAlerts:
    @JHLJun 06.2003 — Should be the same as yours. If it does not work, put the <span> inside the <td> and when writing to the layer, just write the content without the <td>.
    Copy linkTweet thisAlerts:
    @TimauthorJun 06.2003 — JHL (or anybody in the know),

    is <layer> supported in NN 4.61?

    -T
    Copy linkTweet thisAlerts:
    @Khalid_AliJun 06.2003 — Yes..<layer> tag is only supported in NS<5

    Beginning NS6> and above its not suppoprted.
    Copy linkTweet thisAlerts:
    @JHLJun 06.2003 — should be support. I've attached a html file that write content to a table cell. Test and work in IE5, NS7 and NN4.7 . The NN4.7 part involved 2 <span>.

    [upl-file uuid=32d2f9bb-34b3-4078-8f32-9e00296e6a90 size=858B]popup.zip[/upl-file]
    Copy linkTweet thisAlerts:
    @TimauthorJun 06.2003 — 

    I'm at home so I can't test on NN right now, but I did go through that zipped file. There was more than I could absorb in it, so I cut it down to the following and testing on IE 5.5
    ================


    <html>

    <head>

    <STYLE TYPE="text/css">

    .holder {position:relative;visibility:hidden}

    .dynamic {position:absolute;visibility:hidden}

    </STYLE>

    </head>

    <body>

    <script>

    function try() {

    if(document.getElementById)

    document.getElementById('cell1').innerHTML = "Hey";

    else if(document.layers){

    with(document.layers['dlyr1'].document){

    open();

    write("Yo");

    close();

    }

    }

    </script>

    <table width="100%" border="1">

    <tr>

    <td id="cell1"><span id="hlyr1" class="holder"><div id="dlyr1" class="dynamic">X</div></span></td>

    </tr>

    </table>

    <input type="button" name="btn" value="button" onClick="try();">

    </body>

    </html>
    =========================



    Sadly, in IE 5.5 the table does not display anything inside nor does the button alter the display. Rats!

    Regards,

  • - Tim
  • Copy linkTweet thisAlerts:
    @JHLJun 06.2003 — <html>

    <head>

    <title></title>

    <STYLE TYPE="text/css">

    .holder {position:relative}

    .dynamic {position:absolute;visibility:hidden}

    </STYLE>

    <script type="text/javascript">

    function change()

    {

    if(document.getElementById)

    {

    document.getElementById('cell1').innerHTML = "hey";

    }

    else if(document.layers)

    {

    document.layers['dlyr'].top=document.layers['hlyr'].pageY;

    document.layers['dlyr'].left=document.layers['hlyr'].pageX;

    document.layers['hlyr'].visibility='hidden';

    document.layers['dlyr'].visibility='visible';

    with(document.layers['dlyr'].document)

    {

    open();

    write("Hey");

    close();

    }

    }

    }

    </script>

    </head>

    <body>

    <table border="1" width="100%">

    <tr>

    <td id="cell1"><span id="hlyr" class="holder">Yo!</span></td>

    </tr>

    </table>

    <br>

    <form>

    <input type="button" value="click" onclick="change();">

    </form>

    <span id="dlyr" class="dynamic"></span>

    </body>

    </html>


    ok, I change it make it simple. This work in NN4.7, IE5.5 and NS7.

    The second <span> with class"dynamic" can be put anywhere is the <body>. The important one is the <span> with class="holder" which is use to set the location of the other <span> so that you can dynamically change the content.
    Copy linkTweet thisAlerts:
    @TimauthorJun 06.2003 — Thanks for dumbing down the code to where I could get it. That's what I was looking for. Thanks to all who replied!

    Best Regards,

  • - Tim
  • ×

    Success!

    Help @Tim spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...