[I'm not a native english speaker, sorry for my mystakes]

I've just created my first script using jquery. The goal was to create
a form with images you can click to select an option instead of using
classical radio buttun.

The html code is the following :

<table class="DynSelect">
   <tr>
      <td class="first"><input type="radio" name="tendance"
value="110" checked="checked" /></td>
      <td><img src="/icon/meteo/tendance_110.gif" alt="temps peu
nuageux" /></td>
      <td class="first"><input type="radio" name="tendance"
value="109" /></td>
      <td><img src="/icon/meteo/tendance_109.gif" alt="temps degagé" /
></td>
      <td class="first"><input type="radio" name="tendance"
value="122" /></td>
      <td><img src="/icon/meteo/tendance_122.gif" alt="Temps très
nuageux éventuellement couvert" /></td>
      <td class="first"><input type="radio" name="tendance"
value="111" /></td>
      <td><img src="/icon/meteo/tendance_111.gif" alt="temps nuageux" /
></td>
      <td class="first"><input type="radio" name="tendance"
value="112" /></td>
      <td><img src="/icon/meteo/tendance_112.gif" alt="temps couvert" /
></td>
   </tr>
   <tr>
      <td class="first"><input type="radio" name="tendance"
value="113" /></td>
      <td><img src="/icon/meteo/tendance_113.gif" alt="temps degagé et
mer de nuages" /></td>
      <td class="first"><input type="radio" name="tendance"
value="114" /></td>
      <td><img src="/icon/meteo/tendance_114.gif" alt="temps se
couvrant" /></td>
      <td class="first"><input type="radio" name="tendance"
value="117" /></td>
      <td><img src="/icon/meteo/tendance_117.gif" alt="temps se
dégageant" /></td>
      <td colspan="2">&nbsp;</td>
      <td colspan="2">&nbsp;</td>
  </tr>
</table>

And my jquery was is

 $(document).ready(function()
 {
     // structure --> tr.DynSelect > (td > input type=radio) | (td >
img)
     $("table.DynSelect td.first").each(function() {

         if ($(this).children().attr('checked') == true)
            $(this).next().css("background-color","yellow");

         $(this).next().children().click( function()
                          {
                             $
(this).parent().parent().parent().children().children().each(function()
{$(this).css("background-color","transparent")});
                             $(this).parent().css("background-
color","yellow");
                             $
(this).parent().prev().children().attr('checked','checked');
                          });
     }).hide();
 });

I'm the feeling that my jquery code is not as good as it should be,
because the loading time of the page with the script is rather long.

Could anyone suggest any tips or helps? Any comments will help me.

Tk!

Reply via email to