C# firefox中出现未定义
我以前的问题得到了回答,但现在IE中的工作原理与Firefox中的工作原理不同 我的C#看起来像这样:C# firefox中出现未定义,c#,javascript,asp.net,firefox,C#,Javascript,Asp.net,Firefox,我以前的问题得到了回答,但现在IE中的工作原理与Firefox中的工作原理不同 我的C#看起来像这样: protected void OnRowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("ondblclick", "sample(this)");
protected void OnRowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("ondblclick", "sample(this)");
}
}
function sample(rowIn) {
alert("D");
var gViewRowColumn = rowIn.cells[0];
var displayCell = gViewRowColumn.innerText;
alert(displayCell);
}
我的javascript如下所示:
protected void OnRowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("ondblclick", "sample(this)");
}
}
function sample(rowIn) {
alert("D");
var gViewRowColumn = rowIn.cells[0];
var displayCell = gViewRowColumn.innerText;
alert(displayCell);
}
问题是,这在IE中运行良好,但当我在Firefox中尝试时,在警报D显示“D”后,下一个警报只显示“undefined”。我在谷歌上搜索了一下,发现了一些与事件有关的东西,但我无法理解,也无法正确实施它们。任何帮助都将不胜感激。firefox中没有
innerText
这样的属性,请使用
像这样的东西应该适合你的需要
var displayCell = gViewRowColumn.innerText || gViewRowColumn.textContent;
firefox中没有像
innerText
这样的属性,请使用
像这样的东西应该适合你的需要
var displayCell = gViewRowColumn.innerText || gViewRowColumn.textContent;
谢谢那真让我头疼。有没有地方可以让我看看Firefox和IE的工作列表?我讨厌在几个小时内试图解决一个问题,而正是我的无知害死了我。@GetRichSlow1好吧,这里有一些你可能会遇到的事情,希望它能为你解决。。谢谢那真让我头疼。有没有地方可以让我看看Firefox和IE的工作列表?我讨厌在几个小时内试图解决一个问题,而正是我的无知害死了我。@GetRichSlow1好吧,这里有一些你可能会遇到的事情,希望它能为你解决。。