Click to See Complete Forum and Search --> : Does Netscape support some equivalent of the <span> tag?


Tim
06-05-2003, 07:15 PM
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

Khalid Ali
06-05-2003, 07:34 PM
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...

Tim
06-05-2003, 07:45 PM
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

JHL
06-05-2003, 07:54 PM
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();
}

Tim
06-05-2003, 07:59 PM
Thanks JHL but what does the HTML look like with the <layer> tag?

Regards,

- Tim

JHL
06-05-2003, 08:03 PM
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>.

Tim
06-05-2003, 08:19 PM
JHL (or anybody in the know),

is <layer> supported in NN 4.61?

-T

Khalid Ali
06-05-2003, 08:28 PM
Yes..<layer> tag is only supported in NS<5

Beginning NS6> and above its not suppoprted.

JHL
06-05-2003, 08:30 PM
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>.

Tim
06-05-2003, 11:07 PM
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

JHL
06-06-2003, 01:52 AM
<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.

Tim
06-06-2003, 11:58 AM
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