C# Javascript未定义属性
我是Javascript新手,我得到了以下信息: 我有一个C# Javascript未定义属性,c#,javascript,asp.net,C#,Javascript,Asp.net,我是Javascript新手,我得到了以下信息: 我有一个GridView和以下事件: protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { foreach (TableCell c in e.Row.Cells) { c.Attributes.Add("full","false"); } } 在我的javascript中,每个单元格都有一个onClick事件: if(sou
GridView
和以下事件:
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
foreach (TableCell c in e.Row.Cells)
{
c.Attributes.Add("full","false");
}
}
在我的javascript中,每个单元格都有一个onClick
事件:
if(source.full="false")
{
...
source.full="true";
}
else
{
...
source.full="false";
}
为什么
source.full
在第一次点击时总是undefined
?我现在用getAttribute和setAttribute代替Simen说的,效果很好。我现在用getAttribute和setAttribute代替Simen说的,效果很好。我猜你在JavaScript中引用的就是这个与您在原始生成代码中设置的内容不一样。您是否尝试过source.getAttribute(“full”)而不是source.full?我猜您在JavaScript中引用的内容与您在原始生成代码中设置的内容不一样。您是否尝试过source.getAttribute(“full”)而不是source.full?