Re: How to embed javascript functionality into a Perl CGI script?

From: Vibhu (vbontala9_at_yahoo.com)
Date: 09/29/04


Date: 28 Sep 2004 20:25:29 -0700

Brendon,

I agree with you. Does it mean we can't do dynamic magic in CGI Perl?
If so, how can it happen? I had prior experience with JSP and
Javascript. JSP executes on server side and Javascript on the client.

What actually happens is when Javascript code is embedded inside a
server side script, client side code won't get interpreted by the
server. Server executes the server side part of it and evaluates it's
values and returns boh HTML and Javascript to the browser(client).

Client then displays HTML pages along with values returned by server.

I did this in JSP. But haven't ever seen how this can be done in perl.
So, I'd appreciate help.

Thanks again.
-Vibhu

Brendon Caligari <bcaligari@nospam.fireforged.com> wrote in message news:<4159d483$0$94918$bed64819@news.gradwell.net>...
> Vibhu wrote:
>
> > I have this fundamental problem where I am trying to generate some
> > HTML content using Perl CGI script. Currently, my CGI script uses some
> > variables to calculate and value retrieval stuff and throws that onto
> > a HTML format. In addition to this, I want to add dynamic capability
> > to my CGI script.
> >
> > For example, I generate a HTML web-page using Perl CGI code. In that
> > generated page, if I have some checkboxes/radio buttons/select windows
> > etc, I want to generate some dynamic content if I select one of those
> > elements. This means as soon as I select an item, one of the perl
> > functions should be invoked. Similarly, how could I do "onMouseOver",
> > "onClick" etc kind of stuff with Perl CGI scripts? Please help me.
> >
> > Thanks
> > -Vibhu
>
> CGI scripts are executed at the server side. And server side code can
> only be executed when page in question is requested from the server. To
> achieve what you are after you need code that can execute within the
> browser itself...such as JavaScript.
>
> B.