|
Q732 Is it possible to name an individual cell in a table?
irt.org | Knowledge Base | JavaScript | Table | Q732 [ previous next ]
Q732 Is it possible to name an individual cell in a table?
IIRC you can't name an individual table cell, or you can't in Netscape
Navigator 4, you might in Internet Explorer 4. The browser object
model is particulary weak when it comes to tables.
If you want a cross browser solution then you'll need to use layers
and position them over the table yourself.
<HTML>
<HEAD>
<STYLE type="text/css"><!--
.answers { text-decoration:none; color:black; }
//--></STYLE>
<SCRIPT LANGUAGE="JavaScript"><!--
function showTable() {
var output = '<TABLE BORDER="1" WIDTH="500">' +
'<TR><TD>Is black == white?<\/TD><\/TR>' +
'<TR><TD><A HREF="javascript:wrong()" CLASS="answers" onMouseover="self.status=\'\';return true">Yes</A><\/TD><\/TR>' +
'<TR><TD><A HREF="javascript:correct()" CLASS="answers" onMouseover="self.status=\'\';return true">No</A><\/TD><\/TR>' +
'<\/TABLE>';
if (document.all)
document.all('myTable').innerHTML = output;
else if (document.layers) {
document.layers['myTable'].document.open();
document.layers['myTable'].document.writeln(output);
document.layers['myTable'].document.close();
}
}
function wrong() { alert('Wrong'); }
function correct() { alert('Correct'); }
if (document.all || document.layers)
document.write('<FORM>Reveal Table: <INPUT TYPE="BUTTON" VALUE="Reveal" onClick="showTable()"><\/FORM>');
//--></SCRIPT>
</HEAD>
<BODY>
<SPAN ID="myTable" STYLE="position:absolute"></SPAN>
</BODY>
</HTML>
|
Feedback on 'Q732 Is it possible to name an individual cell in a table?'
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.