views:

70

answers:

2

I want to add interactivity like clicks, hover, onpage load() to a webpage, if i use python for generating xhtml, will python give essential flavors like javascript??

I'm bit confused and starter in python for web development, so is there need to include old javascript into python or the python only can handle interactivity, events as javascript?

+6  A: 

When you use Python for web development, you use it server-side (like PHP). It's not for client-side programming in the same way that JavaScript is. The vast majority of browsers only support JavaScript for client-side programming.

If you want client-side code on a site that's using Python on the server, it still has to use JavaScript on the client.

(For completeness, there is (or used to be) a way to use Python on the client side by installing PyWin32, but then your site would only work for people with that software installed and configured. I'd also be very dubious about its security.)

RichieHindle
To extend that answer: you shouldn't really be using Python to generate the HTML directly. All of the Python web frameworks include templating languages, which are parsed by Python to output HTML. Include (or link to) your Javascript there.
Daniel Roseman
A: 

Also see this answer: http://stackoverflow.com/questions/1540214/can-python-be-used-for-client-side-web-development/1540305#1540305

Basically, the client side should still be Javascript, but you do can use python to develop it.

fungusakafungus