josevellozo Posted May 4, 2009 at 11:14 AM Report #261177 Posted May 4, 2009 at 11:14 AM alguem me pode dizer como e que eu faço para colorir as linhas de uma tabela com duas cores alternadas? o meu ficheiro html le os dados de um ficheiro xml. se precisarem posso postar o codigo http://be-actual.blogspot.com/
Gonçalo_ssb Posted May 4, 2009 at 12:47 PM Report #261202 Posted May 4, 2009 at 12:47 PM Para uma melhor percepção e de modo a podermos explicar melhor a solução se não te importares coloca ai o código...
josevellozo Posted May 4, 2009 at 01:18 PM Author Report #261209 Posted May 4, 2009 at 01:18 PM <html> <body> <script type="text/javascript"> var xmlDoc=null; if (window.ActiveXObject) {// code for IE xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } else if (document.implementation.createDocument) {// code for Mozilla, Firefox, Opera, etc. xmlDoc=document.implementation.createDocument("","",null); } else { alert('Your browser cannot handle this script'); } if (xmlDoc!=null) { xmlDoc.async=false; xmlDoc.load("Alunos.xml"); document.write("<table border='1'>"); var x=xmlDoc.getElementsByTagName("Alunos"); for (i=0;i<x.length;i++) { document.write("<tr>"); document.write("<td>"); document.write(x.getElementsByTagName("Nome")[0].childNodes[0].nodeValue); document.write("</td>"); document.write("<td>"); document.write(x.getElementsByTagName("Nota")[0].childNodes[0].nodeValue); document.write("</td>"); document.write("</tr>"); } document.write("</table>"); } </script> </body> </html> http://be-actual.blogspot.com/
Soulsick Posted May 4, 2009 at 01:58 PM Report #261217 Posted May 4, 2009 at 01:58 PM boas, não sei se isto funcionará aí, mas podes tentar fazer algo do género dentro do for se ((i % 2) = 0) então imprime numa cor senão imprime noutra cor fim se espero que percebas o exemplo ? 😉
josevellozo Posted May 4, 2009 at 02:01 PM Author Report #261220 Posted May 4, 2009 at 02:01 PM ja tentei fazer algo do genero mas nao sei se o fiz no sitio certo nem se usei a sintaxe correcta... http://be-actual.blogspot.com/
josevellozo Posted May 4, 2009 at 02:04 PM Author Report #261222 Posted May 4, 2009 at 02:04 PM a pouco enganei me... isto e javascript e nao html.... ? http://be-actual.blogspot.com/
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now