JavaScript DHTML/Table/Caption
Содержание
Caption Vertical Align
<source lang="html4strict">
<html> <body>
Cell 1 | Cell 2 |
Cell 3 | Cell 4 |
</body> </html>
</source>
Create a Caption
<source lang="html4strict">
<html> <body> <script language="JavaScript"> function function1() {
var myC = document.getElementById("myT").createCaption(); myC.innerText = "This is the new caption text";
} </script>
This table has no caption |
---|
<input id="myT" type="button" value="Add caption" onclick="function1();"> </body> </html>
</source>
Delete a Caption
<source lang="html4strict">
<html> <body> <script language="JavaScript"> function function1() {
document.all.myT.deleteCaption();
} </script>
Cell 1 | Cell 2 |
---|
<input type="button" value="Remove caption" onclick="function1();"> </body> </html>
</source>
<source lang="html4strict">
<html> <body id="myBody">
Cell 1 | Cell 2 | Cell 3 |
Cell 1 | Cell 2 | Cell 3 |
Cell 1 | Cell 2 | Cell 3 |
<button onclick="alert(document.all.myTable.caption);">Table Caption</button> </body> </html>
</source>
Table Caption align Example
<source lang="html4strict">
<html> <head> <script language="JavaScript">
function function1() { document.all.myCaption.align = event.srcElement.id; }
</script> </head> <body>
Cell 1 | Cell 2 |
Cell 3 | Cell 4 |
<input type="Button" id="bottom" value="align "bottom"" onClick="function1();">
<input type="Button" id="left" value="align "left"" onClick="function1();">
<input type="Button" id="right" value="align "right"" onClick="function1();">
<input type="Button" id="top" value="align "top"" onClick="function1();">
</body>
</html>
</source>