Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2998 connectés 

  FORUM HardWare.fr
  Programmation
  HTML/CSS

  Correction d'un code

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Correction d'un code

n°1946558
apz
Posté le 02-12-2009 à 11:56:33  profilanswer
 

Bonjour,
le problème que ce code vient ainsi dans l'index du site, et il fonctionne trés bien :

Code :
  1. <!ENTITY % HTMLspecial PUBLIC "-//W3C//ENTITIES Special//EN//HTML" "http://www.w3.org/TR/REC-html40-971218/HTMLspecial.ent"> <HTML><head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta http-equiv="Content-Language" content="fr"> <META content="ALL" name="ROBOTS"> <META NAME="REVISIT-AFTER" CONTENT="1 DAYS"> <META NAME="RATING" CONTENT="GENERAL"> <title></title> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <link rel="stylesheet" type="text/css" href="html/css/asd.css"> <script language="javascript" type="text/javascript"> function mail(user, domain){window.location = 'mailto:'+user+'@'+domain;} </script><script language="JavaScript" type="text/javascript"> function rafiawin(external, height, width) {     options = 'height=' + height + ',width=' + width + ',scrollbars=yes,resizable=yes,top=0,left=0'; window.open(external, 'rafia', options); } function fermer() {     self.close(); } </script> </head> <body bgcolor="#515773"> ..... <p></p> <p></p> <html>  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252>  <script language="JavaScript1.2"> var ns6=document.getElementById&&!document.all var ie=document.all  function changeto(e,highlightcolor){ source=ie? event.srcElement : e.target if (source.tagName=="TR"||source.tagName=="TABLE" ) return while(source.tagName!="TD"&&source.tagName!="HTML" ) source=ns6? source.parentNode : source.parentElement if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore" ) source.style.backgroundColor=highlightcolor }  function contains_ns6(master, slave) { //check if slave is contained by master while (slave.parentNode) if ((slave = slave.parentNode) == master) return true; return false; }  function changeback(e,originalcolor){ if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore" )||source.tagName=="TR"||source.tagName=="TABLE" ) return else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore" )) return if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source) source.style.backgroundColor=originalcolor } </script> </head>   <body>  <div align="center"> <table border="0" cellpadding="0" style="border-collapse: collapse" width="350"> <tr> <td align="center" width="100%" height="111" valign="top">  <style type="text/css"> a {     color: blue;     text-decoration: none; } a:hover {     color : red;     text-decoration: none; } div {     font-family: verdana; } </style>  <div align="center"> <table border="0" cellpadding="0" style="border-collapse: collapse" width="100%"> <tr> <td width="150" align="center" valign="top"> <p align="center"></p>   <div id="a" style="display: none;">  <p dir="ltr">  <table border=0 width=98%><table border=0 width=98%>    <table border="0" cellpadding="0" style="border-collapse: collapse" width="145" height="110"> <tr> <td> <p align="center"><a target="_parent" href="news.php?action=view&id=55"> <img border="0" src="filemanager.php?action=image&id=<img width=150 height=122 border =0  align=center src=filemanager.php?action=image&id=58 >" width="150" height="122"></a></td> </tr> </table> </p> </div>  <div id="b" style="display: none;">  <p dir="ltr">  <table border=0 width=98%><table border=0 width=98%>    <table border="0" cellpadding="0" style="border-collapse: collapse" width="145" height="110"> <tr> <td> <p align="center"><a target="_parent" href="news.php?action=view&id=51"> <img border="0" src="filemanager.php?action=image&id=<img width=150 height=122 border =0  align=center src=filemanager.php?action=image&id=54 >" width="150" height="122"></a></td> </tr> </table> </p> </div>  <div id="c" style="display: none;">  <p dir="ltr">  <table border=0 width=98%><table border=0 width=98%>    <table border="0" cellpadding="0" style="border-collapse: collapse" width="145" height="110"> <tr> <td> <p align="center"><a target="_parent" href="news.php?action=view&id=41"> <img border="0" src="filemanager.php?action=image&id=<img width=150 height=122 border =0  align=center src=filemanager.php?action=image&id=43 >" width="150" height="122"></a></td> </tr> </table> </p> </div> </td> <td align="right"> <div align="center"> <table border="1" cellpadding="0" style="border-collapse: collapse" width="100%" id="table1" bordercolor="#9DAABF" onmouseover="changeto(event, '2e3b60')" onmouseout="changeback(event, '728cb7')"> <tr>          <style type="text/css"> a {     color: blue;     text-decoration: none; } a:hover {     color : red;     text-decoration: none; } div {     font-family: verdana; } </style>  <script language="javascript"> var speed="1";  var i=1; function showNews() { if (i==1){show(a,b,c);i=0} }  function show(a,b,c) { a.style.display = ''; b.style.display = 'none'; c.style.display = 'none'; } setInterval("showNews()", speed*2000); </script>  <td bgcolor="#728cb7" align="center" width="100%" height="40">  <p dir="ltr">  <table border=0 width=98%><a href="javascript:void(0)" onmousemove="javascript:show(a,b,c)"> <font color="#000000"> <table border=0 width=98%> <div align="center"> <table border="0" cellpadding="0" style="border-collapse: collapse" width="96%"> <tr> <td id="ignore"> <font face="Tahoma" style="font-size: 9pt" color="#FFFFFF"> <a target="_parent" href="news.php?action=view&id=55"><font color="#FFFFFF">Articles 1</font></a></font></td> </tr> </div> </table> </font></a></p> </td> </tr><tr> <tr> <td bgcolor="#728cb7" align="center" width="100%" height="40">  <p dir="ltr">   <table border=0 width=98%><a href="javascript:void(0)" onmousemove="javascript:show(b,c,a)"> <font color="#000000"> <table border=0 width=98%><div align="center"> <table border="0" cellpadding="0" style="border-collapse: collapse" width="96%"> <tr> <td id="ignore"> <font face="Tahoma" style="font-size: 9pt" color="#FFFFFF"> <a target="_parent" href="news.php?action=view&id=51"><font color="#FFFFFF">Articles 2</font></a></font></td> </tr> </div> </table> </font></a></p> </td> </tr> <tr> <td bgcolor="#728cb7" align="center" width="100%" height="40">  <p dir="ltr">   <table border=0 width=98%> <a href="javascript:void(0)" onmousemove="javascript:show(c,a,b)"> <font color="#000000"> <table border=0 width=98%><div align="center"> <table border="0" cellpadding="0" style="border-collapse: collapse" width="96%"> <tr> <td id="ignore"> <font face="Tahoma" style="font-size: 9pt" color="#FFFFFF"> <a target="_parent" href="news.php?action=view&id=41"><font color="#FFFFFF">Articles 3</font></a></font></td> </tr> </div> </table> </font></a></p> </td> </tr>  </div> </div> </td> </tr> </table> </div> </td> </tr> </table> </div> </body> </html> </tr> </table> </div> </div>  <p></p> <p></p> .... </body>  </html>

 
 
On peux voir deux balises HTML et deux BODY  
 
Je l'ai fait passer dans W3C Validator et il est plein d'erreurs ...
 
J'ai pu corriger quelques uns.
 
j'ai essayé de modifier le code en supprimant les doublons des balises HTML,  BODy et HEAD en deplaçant le "Javascript 1.2" situé dans le deuxieme HEAD dans le HEAD principal du site.
 
Mais voila la page ne s'affiche plus.
 
Est-ce qu'il y'a une façon pour l'aisser le javascript ou est il tout en  supprimmant les balises en double ?
 
Sinon comment récuperer le code de l'effet survol de la souris sur les liens des news pour l'affichage en face de l'image de ce news ?
 
Merci.


---------------
Cordialement.
mood
Publicité
Posté le 02-12-2009 à 11:56:33  profilanswer
 

n°1946561
gatsu35
Blablaté par Harko
Posté le 02-12-2009 à 12:01:04  profilanswer
 

tu ferais un effort pour que ce code soit indenté et on t'aidera
 

Code :
  1. <!ENTITY % HTMLspecial PUBLIC "-//W3C//ENTITIES Special//EN//HTML" "http://www.w3.org/TR/REC-html40-971218/HTMLspecial.ent">   
  2. <HTML> 
  3.   <head>     
  4.     <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">     
  5.     <meta http-equiv="Content-Language" content="fr">     
  6.     <META content="ALL" name="ROBOTS">     
  7.     <META NAME="REVISIT-AFTER" CONTENT="1 DAYS">     
  8.     <META NAME="RATING" CONTENT="GENERAL">     
  9.     <title>   
  10.     </title>     
  11.     <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">     
  12.     <link rel="stylesheet" type="text/css" href="html/css/asd.css"> 
  13. <script language="javascript" type="text/javascript">
  14. function mail(user, domain) {
  15.     window.location = 'mailto:' + user + '@' + domain;
  16. }
  17. </script>
  18. <script language="JavaScript" type="text/javascript">
  19. function rafiawin(external, height, width) {
  20.     options = 'height=' + height + ',width=' + width + ',scrollbars=yes,resizable=yes,top=0,left=0';
  21.     window.open(external, 'rafia', options);
  22. }
  23. function fermer() {
  24.     self.close();
  25. }
  26. </script>         
  27.   </head>   
  28.   <body bgcolor="#515773"> .....     
  29.     <p>   
  30.     </p>     
  31.     <p>   
  32.     </p>     
  33.     <html>       
  34.       <meta http-equiv="Content-Type" content="text/html; charset=windows-1252>         
  35. <script language="JavaScript1.2">
  36.         var ns6 = document.getElementById && !document.all
  37.         var ie = document.all
  38.         function changeto(e, highlightcolor) {
  39.             source = ie ? event.srcElement : e.target
  40.             if (source.tagName == "TR" || source.tagName == "TABLE" ) return while (source.tagName != "TD" && source.tagName != "HTML" ) source = ns6 ? source.parentNode : source.parentElement
  41.             if (source.style.backgroundColor != highlightcolor && source.id != "ignore" ) source.style.backgroundColor = highlightcolor
  42.         }
  43.        
  44.         function contains_ns6(master, slave) { //check if slave is contained by master  
  45.             while (slave.parentNode)
  46.             if ((slave = slave.parentNode) == master) return true;
  47.             return false;
  48.         }
  49.        
  50.         function changeback(e, originalcolor) {
  51.             if (ie && (event.fromElement.contains(event.toElement) || source.contains(event.toElement) || source.id == "ignore" ) || source.tagName == "TR" || source.tagName == "TABLE" ) return
  52.             else if (ns6 && (contains_ns6(source, e.relatedTarget) || source.id == "ignore" )) return if (ie && event.toElement != source || ns6 && e.relatedTarget != source) source.style.backgroundColor = originalcolor
  53.         }
  54.       </script>       
  55.       </head>         
  56.       <body>         
  57.         <div align="center">           
  58.           <table border="0" cellpadding="0" style="border-collapse: collapse" width="350">             
  59.             <tr>               
  60.               <td align="center" width="100%" height="111" valign="top">                 
  61.                 <style type="text/css"> a {     color: blue;     text-decoration: none; } a:hover {     color : red;     text-decoration: none; } div {     font-family: verdana; }                 
  62.                 </style>                 
  63.                 <div align="center">                   
  64.                   <table border="0" cellpadding="0" style="border-collapse: collapse" width="100%">                     
  65.                     <tr>                       
  66.                       <td width="150" align="center" valign="top">                         
  67.                         <p align="center">                       
  68.                         </p>                           
  69.                         <div id="a" style="display: none;">                           
  70.                           <p dir="ltr">                             
  71.                             <table border=0 width=98%>                             
  72.                               <table border=0 width=98%>                                   
  73.                                 <table border="0" cellpadding="0" style="border-collapse: collapse" width="145" height="110">                                   
  74.                                   <tr> <td>                                       
  75.                                       <p align="center">                                       
  76.                                         <a target="_parent" href="news.php?action=view&id=55">                                           
  77.                                           <img border="0" src="filemanager.php?action=image&id=<img width=150 height=122 border =0  align=center src=filemanager.php?action=image&id=58 >" width="150" height="122"></a></td>                                   
  78.                                   </tr>                                 
  79.                                 </table>                           
  80.                           </p>                         
  81.                         </div>                         
  82.                         <div id="b" style="display: none;">                           
  83.                           <p dir="ltr">                             
  84.                             <table border=0 width=98%>                             
  85.                               <table border=0 width=98%>                                   
  86.                                 <table border="0" cellpadding="0" style="border-collapse: collapse" width="145" height="110">                                   
  87.                                   <tr> <td>                                       
  88.                                       <p align="center">                                       
  89.                                         <a target="_parent" href="news.php?action=view&id=51">                                           
  90.                                           <img border="0" src="filemanager.php?action=image&id=<img width=150 height=122 border =0  align=center src=filemanager.php?action=image&id=54 >" width="150" height="122"></a></td>                                   
  91.                                   </tr>                                 
  92.                                 </table>                           
  93.                           </p>                         
  94.                         </div>                         
  95.                         <div id="c" style="display: none;">                           
  96.                           <p dir="ltr">                             
  97.                             <table border=0 width=98%>                             
  98.                               <table border=0 width=98%>                                   
  99.                                 <table border="0" cellpadding="0" style="border-collapse: collapse" width="145" height="110">                                   
  100.                                   <tr> <td>                                       
  101.                                       <p align="center">                                       
  102.                                         <a target="_parent" href="news.php?action=view&id=41">                                           
  103.                                           <img border="0" src="filemanager.php?action=image&id=<img width=150 height=122 border =0  align=center src=filemanager.php?action=image&id=43 >" width="150" height="122"></a></td>                                   
  104.                                   </tr>                                 
  105.                                 </table>                           
  106.                           </p>                         
  107.                         </div> </td>                       
  108.                       <td align="right">                         
  109.                         <div align="center">                           
  110.                           <table border="1" cellpadding="0" style="border-collapse: collapse" width="100%" id="table1" bordercolor="#9DAABF" onmouseover="changeto(event, '2e3b60')" onmouseout="changeback(event, '728cb7')">                             
  111.                             <tr>                                       
  112.                               <style type="text/css">                                                              a {                                  color: blue;                                  text-decoration: none;                                 }                                 a:hover {                                  color: red;                                  text-decoration: none;                                 }                                 div {                                  font-family: verdana;                                 }                                                               
  113.                               </style>                                 
  114. <script language="javascript">
  115.                                  var speed = "1";
  116.                                 var i = 1;
  117.                                
  118.                                 function showNews() {
  119.                                     if (i == 1) {
  120.                                         show(a, b, c);
  121.                                         i = 0
  122.                                     }
  123.                                 }
  124.                                
  125.                                 function show(a, b, c) {
  126.                                     a.style.display = '';
  127.                                     b.style.display = 'none';
  128.                                     c.style.display = 'none';
  129.                                 }
  130.                                 setInterval("showNews()", speed * 2000);
  131.                                  </script>                                 
  132.                               <td bgcolor="#728cb7" align="center" width="100%" height="40">                                 
  133.                                 <p dir="ltr">                                   
  134.                                   <table border=0 width=98%>                                   
  135.                                     <a href="javascript:void(0)" onmousemove="javascript:show(a,b,c)">                                       
  136.                                       <font color="#000000">                                         
  137.                                         <table border=0 width=98%>                                           
  138.                                           <div align="center">                                             
  139.                                             <table border="0" cellpadding="0" style="border-collapse: collapse" width="96%">                                               
  140.                                               <tr>                                                 
  141.                                                 <td id="ignore">                                                   
  142.                                                   <font face="Tahoma" style="font-size: 9pt" color="#FFFFFF">                                                     
  143.                                                     <a target="_parent" href="news.php?action=view&id=55">                                                     
  144.                                                       <font color="#FFFFFF">Articles 1                                                     
  145.                                                       </font></a>                                                 
  146.                                                   </font></td>                                               
  147.                                               </tr>                                           
  148.                                           </div>                                         
  149.                                         </table>                                       
  150.                                       </font></a>                               
  151.                                 </p> </td>                             
  152.                             </tr>                           
  153.                             <tr>                               
  154.                               <tr>                                 
  155.                                 <td bgcolor="#728cb7" align="center" width="100%" height="40">                                   
  156.                                   <p dir="ltr">                                       
  157.                                     <table border=0 width=98%>                                     
  158.                                       <a href="javascript:void(0)" onmousemove="javascript:show(b,c,a)">                                         
  159.                                         <font color="#000000">                                           
  160.                                           <table border=0 width=98%>                                           
  161.                                             <div align="center">                                               
  162.                                               <table border="0" cellpadding="0" style="border-collapse: collapse" width="96%">                                                 
  163.                                                 <tr>                                                   
  164.                                                   <td id="ignore">                                                     
  165.                                                     <font face="Tahoma" style="font-size: 9pt" color="#FFFFFF">                                                       
  166.                                                       <a target="_parent" href="news.php?action=view&id=51">                                                       
  167.                                                         <font color="#FFFFFF">Articles 2                                                       
  168.                                                         </font></a>                                                   
  169.                                                     </font></td>                                                 
  170.                                                 </tr>                                             
  171.                                             </div>                                           
  172.                                           </table>                                         
  173.                                         </font></a>                                 
  174.                                   </p> </td>                               
  175.                               </tr>                               
  176.                               <tr>                                 
  177.                                 <td bgcolor="#728cb7" align="center" width="100%" height="40">                                   
  178.                                   <p dir="ltr">                                       
  179.                                     <table border=0 width=98%>                                       
  180.                                       <a href="javascript:void(0)" onmousemove="javascript:show(c,a,b)">                                         
  181.                                         <font color="#000000">                                           
  182.                                           <table border=0 width=98%>                                           
  183.                                             <div align="center">                                               
  184.                                               <table border="0" cellpadding="0" style="border-collapse: collapse" width="96%">                                                 
  185.                                                 <tr>                                                   
  186.                                                   <td id="ignore">                                                     
  187.                                                     <font face="Tahoma" style="font-size: 9pt" color="#FFFFFF">                                                       
  188.                                                       <a target="_parent" href="news.php?action=view&id=41">                                                       
  189.                                                         <font color="#FFFFFF">Articles 3                                                       
  190.                                                         </font></a>                                                   
  191.                                                     </font></td>                                                 
  192.                                                 </tr>                                             
  193.                                             </div>                                           
  194.                                           </table>                                         
  195.                                         </font></a>                                 
  196.                                   </p> </td>                               
  197.                               </tr>                         
  198.                         </div>                 
  199.                 </div> </td>             
  200.             </tr>           
  201.           </table>         
  202.         </div> </td>         
  203.         </tr>         
  204.         </table>         
  205.         </div>       
  206.       </body>     
  207.     </html>     
  208.     </tr>     
  209.     </table>     
  210.     </div>     
  211.     </div>     
  212.     <p>   
  213.     </p>     
  214.     <p>   
  215.     </p> ....   
  216.   </body> 
  217. </html>


Message édité par gatsu35 le 02-12-2009 à 12:11:26

---------------
Blablaté par Harko
n°1946581
apz
Posté le 02-12-2009 à 12:50:44  profilanswer
 

J'utilise Notpad++ et je ne sais pas s'il a l'option d'indenté les codes ?
 
Merci gatsu35.

n°1946595
gatsu35
Blablaté par Harko
Posté le 02-12-2009 à 13:19:58  profilanswer
 

maintenant la question est : d'ou vient ce code dégueulasse ?


---------------
Blablaté par Harko
n°1946596
apz
Posté le 02-12-2009 à 13:22:51  profilanswer
 

D'un CMS pour news ...
 

n°1947554
apz
Posté le 05-12-2009 à 15:41:51  profilanswer
 

Pas de solution ?

n°1951753
apz
Posté le 19-12-2009 à 14:50:24  profilanswer
 

Salut,
 
Voila un code modifié et testé pour un seul bloque. Il marche bien.
 
A present, je voulais essayer d'avoir deux bloques l'un à coté de l'autre, mais je n'y arrive pas :
 

Code :
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Tab verticales</title>
  6. <meta name="description" lang="fr" content="Essais de tabs verticales accessibles avec jquery" />
  7. <style type="text/css" media="screen">
  8. body {
  9. font-size: 90%;
  10. font-family: arial, helvetica, sans-serif;
  11. }
  12. h1 {
  13. text-align: center;
  14. color: #f00;
  15. }
  16. h3 {
  17. text-align: left;
  18. color: #f00;
  19. font-size: 12px;
  20. }
  21. #articles {
  22. position : relative;
  23. border: 1px solid #000;
  24. width: 352px;
  25. height : 123px;
  26. }
  27. #articles h3, #articles h3 a {
  28. color: #900;
  29. }
  30. /*.hasJS #articles {min-height:200px;}*/
  31.   .hasJS #articles h3 {
  32. cursor: pointer;
  33. background-color: #999;
  34. margin: 0;
  35. padding: 5px;
  36. border-bottom:  #fff 1px solid;
  37. border-right:  #fff 1px solid;
  38. width:190px;
  39. height:30px;
  40. }
  41. .hasJS #articles h3.selected {
  42. background-color: #E5E5E5;
  43. border-right: #fff 1px solid;
  44. }
  45. .hasJS #articles div div.montre {
  46. position: absolute;
  47. top: 0;
  48. right: 0;
  49. left: 196px;
  50. }
  51. .hasJS #articles div div {
  52. position: absolute;
  53. top: -5000px;
  54. left: -5000px;
  55. padding-left: 5px;
  56. }
  57. .imag {
  58. width:150px;
  59. height:122px;
  60. }
  61. a:link, a:visited, a:active {
  62. text-decoration: none;
  63. color: #333333;
  64. }
  65. </style>
  66. <script type="text/javascript">
  67.   document.documentElement.className+=" hasJS";
  68. </script>
  69. </head>
  70. <body>
  71. <h1>Tab verticales</h1>
  72. <h2>Une série de h3 en tab horizontales</h2>
  73. <div id="articles">
  74.   <div class="article">
  75.     <h3 class="selected"><a href="#">Massacre aux Philippines: le clan a tué 200 autres personnes</a></h3>
  76.     <div class="montre"> <img class="imag"src="news1.jpg" alt="Figure 1" /> </div>
  77.   </div>
  78.   <div class="article">
  79.     <h3><a href="#">Le patronat européen prêt à des efforts sur le CO2 si les Etats-Unis
  80.       suivent</a></h3>
  81.     <div> <img class="imag" src="news2.jpg" alt="Figure 2" /> </div>
  82.   </div>
  83.   <div class="article">
  84.     <h3><a href="#">Johnny Hallyday hospitalisé à Los Angeles</a></h3>
  85.     <div> <img class="imag" src="news3.jpg" alt="Figure 3" /> </div>
  86.   </div>
  87. </div>
  88. <div id="articles2">
  89.   <div class="article">
  90.     <h3 class="selected"><a href="#">Massacre aux Philippines: le clan a tué 200 autres personnes</a></h3>
  91.     <div class="montre"> <img class="imag"src="news1.jpg" alt="Figure 1" /> </div>
  92.   </div>
  93.   <div class="article">
  94.     <h3><a href="#">Le patronat européen prêt à des efforts sur le CO2 si les Etats-Unis
  95.       suivent</a></h3>
  96.     <div> <img class="imag" src="news2.jpg" alt="Figure 2" /> </div>
  97.   </div>
  98.   <div></div>
  99.   <div class="article">
  100.     <h3><a href="#">Johnny Hallyday hospitalisé à Los Angeles</a></h3>
  101.     <div> <img class="imag" src="news3.jpg" alt="Figure 3" /> </div>
  102.   </div>
  103. </div>
  104. <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
  105. <script type="text/javascript">
  106.    $(document).ready( function () {
  107.     //tabindex pour la navigation au clavier
  108.     $("#articles h3" ).attr("tabindex", "0" );
  109.     $("#articles h3" ).focus (
  110.      function () {
  111.       //trucs à faire pendant le focus sur les h3
  112.       $("#articles div.montre" ).removeClass("montre" );
  113.       $("#articles h3.selected" ).removeClass("selected" );
  114.       $(this).next("div" ).addClass("montre" );
  115.       $(this).addClass("selected" );
  116.      }
  117.     );
  118.     // gestion des hover sur les h3 :
  119.     $("div.article h3" ).hover(
  120.      function () {
  121.       //trucs à faire pendant le over sur les h3
  122.       $("#articles div.montre" ).removeClass("montre" );
  123.       $("#articles h3.selected" ).removeClass("selected" );
  124.       $(this).next("div" ).addClass("montre" );
  125.       $(this).addClass("selected" );
  126.      },
  127.      function () {
  128.       //out : trucs à faire éventuellement quand le pointeur sort du h3
  129.      }
  130.     );
  131.    });
  132. </script>
  133. </body>
  134. </html>


Mais il y'a un problème de "id" de la div conteneur.
 

Code :
  1. <div id="articles">


 Il faut donner a chaque div son identificateur propre, mais comment sera le code jQuery qui traitera chaque div a part ?  :sarcastic:


Message édité par apz le 19-12-2009 à 14:53:02

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  HTML/CSS

  Correction d'un code

 

Sujets relatifs
bzip2 dans code CGestionnaire de versions de code pour Visual Basic Express 2008
Cheat code Konami sur Facebookavoir le code binaire du bios
Cherche code !!! helpbesoin d'aide sur une correction
Pourquoi ma newsletter arrive en spam? [code inside]Correction d'un code (exercice)
Code de correction d'erreurCorrection de mon code...
Plus de sujets relatifs à : Correction d'un code


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR