Attribute addition failure in setattribute

Source: Internet
Author: User
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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.