开发者

Javascript undefined attribute

开发者 https://www.devze.com 2023-01-26 00:52 出处:网络
I\'m new to Javascript and I got this: I have a GridView with the following event: protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)

I'm new to Javascript and I got this:

I have a GridView with the following event:

protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
  foreach (TableCell c in e.Row.Cells)
  {
    c.Attributes.Add("full","false");
  }
}

And in my javascript I have an onClick event for every cell:

if(source.full="false")
{
  ...
  source.full="true";
}
else
{
  ...
  source.full="false";
}

Why is it that source.full开发者_开发技巧 is always undefined on the first click?


I now used getAttribute and setAttribute instead like Simen said and it works very well.

0

精彩评论

暂无评论...
验证码 换一张
取 消