0
我試着閃爍了ASp:Gridview的行。在IE中成功了,但在FF和safari中沒有工作。 FF錯誤控制檯說「錯誤:gridRef.childNodes是不是一個函數」誰能告訴我哪兒我錯了......Gridview行閃爍
JavaScript的使用是:
<script type="text/javascript">
<!--
function blinkElement(elementId)
{
var elementRef = document.getElementById(elementId);
var blinkCounter = parseInt(elementRef.blinkCounter);
if (isNaN(blinkCounter) == true)
blinkCounter = 0;
if ((blinkCounter % 2) == 0)
{
elementRef.style.visibility = 'visible';
}
else
{
elementRef.style.visibility = 'hidden';
}
if (blinkCounter < 1)
{
blinkCounter++;
}
else
{
blinkCounter--
}
elementRef.blinkCounter = blinkCounter;
window.setTimeout('blinkElement(\"' + elementId + '\")', 700);
}
function blinkGridViewRows()
{
var gridRef = document.getElementById('<%= gvUsers.ClientID %>');
for (var i=0; i<gridRef.childNodes.length; i++)
{
var bodyRef = gridRef.childNodes(i);
for (var j=0; j<bodyRef.childNodes.length; j++)
{
var trRef = bodyRef.childNodes(j);
if (trRef.blinkingRow == 'Y')
{
blinkElement(trRef.id);
}
}
}
}
window.onload = blinkGridViewRows;
// -->
</script>
和我gridview_rowdatabound我有
e.Row.Attributes.Add("blinkingRow", "Y");