HTML DOM td / th ch property
Definition and Usage
ch property sets or returns the cell alignment character.
All in the same column cell content alignment depends on this character.
grammar
Setting ch properties:
tdObject.ch="text"
或者
thObject.ch="text"
或者
thObject.ch="text"
Returns ch attributes:
tdObject.ch
或者
thObject.ch
或者
thObject.ch
Tip property property has no default value.
Browser Support
All major browsers support ch property. However, no major browser will perform the functions of the property.
Examples
Examples
. "" In character alignment "Savings" column:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var c = document.getElementById ( "myCol");
alert ( "second column alignment characters are:" + c.ch);
}
</ Script>
</ Head>
<Body>
<Table border = "1">
<Colgroup>
<Col>
<Col id = "myCol" align = "char" char = ".">
</ Colgroup>
<Tr>
<Th> Month </ th>
<Th> Deposit </ th>
</ Tr>
<Tr>
<Td> January </ td>
<Td> $ 100.00 </ td>
</ Tr>
<Tr>
<Td> February </ td>
<Td> $ 10.00 </ td>
</ Tr>
</ Table>
<br>
<Button type = "button" onclick = "displayResult ()"> Get character alignment </ button>
<P> <b> Note: </ b> Not all major browsers support char attributes. </ P>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var c = document.getElementById ( "myCol");
alert ( "second column alignment characters are:" + c.ch);
}
</ Script>
</ Head>
<Body>
<Table border = "1">
<Colgroup>
<Col>
<Col id = "myCol" align = "char" char = ".">
</ Colgroup>
<Tr>
<Th> Month </ th>
<Th> Deposit </ th>
</ Tr>
<Tr>
<Td> January </ td>
<Td> $ 100.00 </ td>
</ Tr>
<Tr>
<Td> February </ td>
<Td> $ 10.00 </ td>
</ Tr>
</ Table>
<br>
<Button type = "button" onclick = "displayResult ()"> Get character alignment </ button>
<P> <b> Note: </ b> Not all major browsers support char attributes. </ P>
</ Body>
</ Html>
try it"
td / th objects