PDA

View Full Version : Adding javascript in a cgi script


Tsost
10-16-2007, 01:56 AM
I'd like to put a pop-up page in in my website that also brings the the window to the front of the page, however the page where the code would be is a cgi script and I'm not sure how the cgi would work with the javascript.

Normally the javascript would appear in the HTML, eg

<HEAD>
<TITLE>
<SCRIPT LANGUAGE=JAVASCRIPT>
mapWindow=window.open('test.gif', mapWin, 'toolbar=yes, scrollbar=yes, width=300, height=300') etc

Can anyone show me how to do this?

KevinADC
10-16-2007, 02:12 AM
You put javascript into the html code that a CGI script prints the same as a regular html document.

Tsost
10-23-2007, 05:44 AM
Thanks

ivancorne
11-02-2007, 05:46 AM
Should you need to run a CGI script when a web page loads, a JavaScript tag can be utilized. The SRC of the JavaScript tag is the URL of the script.

The CGI script runs, doing what it's programmed to do for you. Before the script quits, it sends some JavaScript code to the browser, satisfying the browser's request. The JavaScript can be an empty variable declaration or it can be code that actually does something for the web page.

KevinADC
11-03-2007, 07:39 AM
Should you need to run a CGI script when a web page loads, a JavaScript tag can be utilized. The SRC of the JavaScript tag is the URL of the script.

The CGI script runs, doing what it's programmed to do for you. Before the script quits, it sends some JavaScript code to the browser, satisfying the browser's request. The JavaScript can be an empty variable declaration or it can be code that actually does something for the web page.


All true, but I don't think thats what the OP was asking. They were just not sure how to include javascript in a dynamically generated page created by a CGI script. The answer is you do it just the same as a static html document.

airgle
11-11-2007, 03:04 PM
I would prefer to insert a script in a static html