html tags and python

EP EP at zomething.com
Sat Mar 26 21:07:01 EST 2005


 
>  <select>
>         <option name = "1" value="1">January
>         <option name = "2" value="2">February
>         <option name = "3" value="3">March
>         <option name = "4" value="4">April
>         <option name = "5" value="5">May
>         <option name = "6" value="6">June
>         <option name = "7" value="7">July
>         <option name = "8" value="8">August
>         <option name = "9" value="9">September
>         <option name = "10" value="10">October
>         <option name = "11" value="11">November
>         <option name = "12" value="12">December
>         </select>
> 
> The thing is:
> I also want the user to choose a date
> I will make this with another dropdownbox.
> But if the first month is selected, then there should be 31 days in the 
> days
> dropdownbox, if the second month is selected there should be 28 days in 
> the
> dropdownbow.


Python is great, but I'd suggest trying this with JavaScript and the DOM (Document Object Model).  In fact you may be able to Google-up a JavaScript script that does what you want.  JavaScript executes on the client machine, which is perfect for that aspect of your application.

The general idea would be to have the script redefine the option values for days upon selection of the year and month.  The DOM lets you access those <option>s at run time very easily.

JavaScript is not as robust a programming language as Python, but it is handy for executing certain functionality within a browser interface, and because it works within the browser and can access the DOM, there is an element of instant gratification.

Then... about the time you start to try to build a real application with JavaScript, it will start to drive you mad... and you will have a new, greater affection for Python.




More information about the Python-list mailing list