Can python do something like the onclick events in javascript ?

Benjamin Kaplan benjamin.kaplan at case.edu
Mon Aug 3 20:54:58 CEST 2009


On Mon, Aug 3, 2009 at 2:39 PM, Leo Brugud <sakradevanamindra at gmail.com>wrote:

> I'm trying to use python to build a simple web page that make use of
> the onclick behavior, instead of requiring users
> to click the 'submit' button.
>
> I realize in javascript there are onclick, onchange events. Is python
> capable of doing the same?
>


It depends. Python is usually used as a server-side language while
Javascript is client-side. The client's web browser requests a web page,
your program processes that request and sends the client a web page. That
web page can contain anything you want, including Javascript. Your python
program never hears from that client again until the *client* initiates
contact, be it through a submit button or a javascript event that submits an
HTTP request. You'll have to add the onclick and onchange code to the
resulting web page, using Javascript, because Python never handles sending
the request, jsut receiving it.

Of course, this isn't the case if you are using something like pyjs, which
compiles Python code to Javascript, your code will be running as Javascript
code and not Python code.


>
> Thanks in Advance
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090803/564615e8/attachment.html>


More information about the Python-list mailing list