Código fuente de 'Colorea tabla.asp'

<html>
<head>
<title>Colorea tabla - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>

<body style="font-family: Arial; font-size: 9pt">

<center><b><font face="Arial" size="3">Colorea tabla</font></b></center><br>

Si quieres cambiar los colores de coloreado, modifica los valores WHITE (blanco),
YELLOW (amarillo) y LIGHTBLUE (azul claro) en el código fuente. <br><br>

<!--  By: Jonathan Barton    -->
    
    
    <%
    	'The const's are For the colors and the Flag is needed
    	Const sPrimaryColor = "WHITE"
    	Const sSecondaryColor = "YELLOW"
    	Dim bColorFlag
    	Dim lCounter
    	'This function does all the work For you.
    	function LineColor()
    		bColorFlag = Not bColorFlag
    		if bColorFlag Then
    			LineColor = sPrimaryColor
    		Else
    			LineColor = sSecondaryColor
    		End if
    	End function
    %>
    
    
    
    <SCRIPT language='VBScript'>
    	Dim sRowOldColor
    	Const sHighlightColor = "LIGHTBLUE"
    	
    	Sub Document_onclick()
    		
    		Dim sID
    		
    		'Need To show the parent of the element that was clicked on
    		if Window.Event.srcElement.tagName = "TD" Then 
    			sID = Window.Event.srcElement.ParentElement.id
    			MsgBox "ID = " & sID,,"This is the ID of the row."
    		End if		
    	End Sub
    	Sub Document_onmouseover()
    		if Window.Event.srcElement.tagName = "TD" Then 
    			sRowOldColor = window.event.srcElement.ParentElement.bgcolor
    			window.event.SrcElement.ParentElement.bgcolor=sHighlightColor
    		End if
    	End Sub
    	
    	Sub Document_onmouseout ()
    		if window.event.srcElement.tagName = "TD" Then 
    			window.event.srcElement.parentElement.bgcolor = sRowOldColor
    		End if
    	End Sub
    </SCRIPT>
    <HTML>
    	<HEAD>
    		<TITLE>
    			Alternating Line Colors	
    		 - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
    	</HEAD>
    	<BODY>
    		<CENTER>
    			<P>
    				<BR>
    			</P>
    			<TABLE width='80%' cellspacing='3' cellpadding='3' border='1'>
    			<%
    				For lCounter = 1 To 10
    					Response.Write("<TR bgcolor='" & LineColor & "' id='" & lCounter & "'>" & vbCrLf)
    					Response.Write("<TD><CENTER>" & lCounter & "</CENTER></TD>" & vbCrLf)
    					Response.Write("</TR>" & vbCrLf)
    				Next
    			%>
    			</TABLE>
    		</CENTER>
    	</BODY>
    </HTML>