[Devel] r196 - trunk

svn at agendadulibre.org svn at agendadulibre.org
Jeu 2 Nov 19:26:14 CET 2006


Author: thomas
Date: Thu Nov  2 19:26:13 2006
New Revision: 196

Modified:
   trunk/funcs.inc.php

Log:
Utilisation de l'évènement "onchange" de <select>, plutôt que
l'évènement "onclick" des <option>. D'une part, le code est plus
court, et surtout, ça fonctionne sous Konqueror et Internet Explorer.



Modified: trunk/funcs.inc.php
==============================================================================
--- trunk/funcs.inc.php	(original)
+++ trunk/funcs.inc.php	Thu Nov  2 19:26:13 2006
@@ -372,7 +372,8 @@
     echo " <a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;region=".$region."\"> &gt;&gt; </a>\n";
 
   echo "<form>\n";
-  echo "<select>\n";
+  echo "<select onchange=\"window.location='?year=" . $year . "&amp;month=" .
+    $month . "&amp;region=' + this.options[this.selectedIndex].value\">\n";
 
   $ret = $db->query ("select * from regions");
   if ($ret == FALSE)
@@ -382,24 +383,16 @@
       exit;
     }
 
-  echo "<option onclick=\"window.location='?year="      . $year .
-                                          "&amp;month=" . $month . "'\"" .
-               "value=\"all\">Toutes les régions</option>\n";
+  echo "<option value=\"all\">Toutes les régions</option>\n";
 
   while ($row = mysql_fetch_object($ret))
     {
       if ($row->id == $region)
 	echo
-	  "<option onclick=\"window.location='?year="          . $year .
-	                                      "&amp;month="    . $month .
-	                                      "&amp;region="   . $row->id . "'\"" .
-	           "value=\"" . $row->id . "\" selected=\"1\">" . $row->name . "</option>\n";
+	  "<option value=\"" . $row->id . "\" selected=\"1\">" . $row->name . "</option>\n";
       else
 	echo
-	  "<option onclick=\"window.location='?year="       . $year .
-                                              "&amp;month=" . $month .
-                                              "&amp;region=" . $row->id . "'\"" .
-	          "value=\"" . $row->id . "\">" . $row->name . "</option>\n";
+	  "<option value=\"" . $row->id . "\">" . $row->name . "</option>\n";
     }
 
   echo "</select>";
@@ -432,7 +425,9 @@
     echo " <a href=\"?year=".$next_year."&amp;region=".$region."\"> &gt;&gt; </a>\n";
 
   echo "<form>";
-  echo "<select>\n";
+
+  echo "<select onchange=\"window.location='?year=" . $year .
+    "&amp;region=' + this.options[this.selectedIndex].value\">\n";
 
   $ret = $db->query ("select * from regions");
   if ($ret == FALSE)
@@ -442,21 +437,16 @@
       exit;
     }
 
-  echo "<option onclick=\"window.location='?year="      . $year .
-               "value=\"all\">Toutes les régions</option>\n";
+  echo "<option value=\"all\">Toutes les régions</option>\n";
 
   while ($row = mysql_fetch_object($ret))
     {
       if ($row->id == $region)
 	echo
-	  "<option onclick=\"window.location='?year="          . $year .
-	                                      "&amp;region="   . $row->id . "'\"" .
-	           "value=\"" . $row->id . "\" selected=\"1\">" . $row->name . "</option>\n";
+	  "<option value=\"" . $row->id . "\" selected=\"1\">" . $row->name . "</option>\n";
       else
 	echo
-	  "<option onclick=\"window.location='?year="       . $year .
-                                              "&amp;region=" . $row->id . "'\"" .
-	          "value=\"" . $row->id . "\">" . $row->name . "</option>\n";
+	  "<option value=\"" . $row->id . "\">" . $row->name . "</option>\n";
     }
 
   echo "</select>";


Plus d'informations sur la liste de diffusion Devel