Gridview rows blinking
I tried blink the rows of ASp:Gridview. Have succeded in IE but not working in FF and safari. FF error console says "Error: gridRef.childNodes is not a function" Can anybody tell me where exactly I am wrong...
The Javascript used is:
<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 blinkGridViewRow开发者_开发技巧s()
{
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>
and on my gridview_rowdatabound I have
e.Row.Attributes.Add("blinkingRow", "Y");
You can access items of an array in JavaScript with square brackets. change
gridRef.childNodes(i);
to
gridRef.childNodes[i];
and
bodyRef.childNodes(j);
to
bodyRef.childNodes[j];
Regards, Tim
精彩评论