object.setAttribute(sName, vValue [, iFlags])
Parameters:
Sname
Required.StringType, attribute name
Vvalue
Required. The variable specified for the attribute. It can be string, number, or boolean type.
Iflags
Optional. The two types specified belowIntegerType flag
0
Overwrite the attributes of the same name.
1
Default Value. Add the specified value for the property.
Strength
<HTML>
<Head runat = "server">
<Title> No title page </title>
<Style type = "text/CSS">
. Tableline
{
Border-collapse: collapse;
Border: 1px solid #9bc2e0;
}
. Tableline TD
{
Border: 1px solid #9bc2e0;
}
</Style>
<SCRIPT type = "text/JavaScript">
Function (){
Document. getelementbyid ("td_id"). setattribute ("colspan", "2", 0); // succeeded
// Document. getelementbyid ("td_id"). setattribute ("colspan", "2"); failed
}
</SCRIPT>
</Head>
<Body onload = "A ()">
<Form ID = "form1" runat = "server">
<Table id = "tableid" class = "tableline">
<Tr>
<TD>
1
</TD>
<TD>
2
</TD>
</Tr>
<Tr>
<TD id = "td_id">
Dasfasfd
</TD>
</Tr>
<Tr>
<TD colspan = "2">
D
</TD>
</Tr>
</Table>
</Form>
</Body>
</Html>