Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cgi parsed javascript

Status
Not open for further replies.

automatic2

Technical User
Jan 5, 2005
20
CA
Can someone help. I have a javascript menu (hmenu) where the html pages loads two scripts, config.js and browser.js. brower.js subsequently refers to a browser dependant construct script (.js) This all works well when accessing the html pages.

Then I changed things up. I wanted to pass several variables along with the pages, so I POSTED my input forms with hidden variables to a Perl script. This script then writes out an html page containing the passed variables, and more importantly my javascript calls. My problem is that the javascript fails to function.

My javascript is

<script type="text/javascript" src="includes/browser.js"></script>
<script type="text/javascript" src="config.js"></script>

I've change up the src="script_loction" with all possible combinations of absolute and referenced script locations. I've adjusted .htaccess to include 'AddHandler server-parsed .html', but to no avail.

any suggestions as to how to serve the html document that contains the javascript calls, and have it all function.
 
It should work - the browser won't care whether the HTML it's reading came from a script or a static file, so long as it can find the scripts concerned.

Does this page have a URL that we could see? Which "possible combinations of absolute and referenced script locations" did you try?

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Thanks.
The specific page would be simply a mirror of a similar html page served up by a cgi-bin/.cgi script. the javascript lies in my public and public/includes. My src=" " has been tried with "config.js", "/config.js", " and a couple more for good measure. the addresses where always duplicated with the 'includes/brower.js'
 
This might a pile o' ****, but because it's an SSI, would it be subject to the same pragmas as CGI scripts.

I've found in the past when generating javascript within perl, apache is quite picky about the header type which is the first thing that's output

Code:
print "Content-Type: text/javascript\n\n";

also what browser are you using? <script type="text/javascript" is replacing <script language="javascript" but older browsers might not be aware

HTH
--Paul

cigless ...
 
That didn't work, every thing beyond 'content-type: text/html\n\n' is printed, including the 'content-type: text/javascript\n\n'. Thanks though.
 
Success. Embarassed...image file not loading in .js script. Thanks for the input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top