I think you need to be a little clearer on the whole client-server communication thing. Basically, the deal is something like this.
- Your browser requests something (say, a CGI script) from a server.
- The server runs the requested script, and sends your browser the output - usually, a bunch of HTML / images etc. - stuff your browser knows how to render.
- Included in that HTML may be Javascript (or JScript or similar) - something too that most browsers know how to cope with. Note that this script is generally not allowed to interact with any part of the client machine *other* than the browser.
- If the HTML contains a form, the values entered are sent back to the server as a new request when the form is submitted. The server can examine this request and take appropriate action
Hopefully you can see from this model that your CGI script runs *on the server*, not the client. The client simply receives the output, renders it, optionally uses client-side-scipting to process it (document.write, onSubmit etc.) and sends it back.
As an aside, you should never *rely* on client-side scripting to validate a form. Having it as an extra check before submission is fine, but the server script should do this also to cater for those who don't run JS / hand craft forms / hack your HTML. Many many JS shopping cart systems have learnt this to their cost :)
Hope this helps, Ben.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|