Chances are it is actually erroring in mid-script. Many coders like to put
print "content-type: text/html\n\n";
right at the beginning of the script. The reason for this is whenever they are wrangling with a problem, they can issue a print command anywhere in the program and it won't server error.
The downside is this - if the script errors and prints something to STDOUT, it doesn't necessarily print to the browser. So you get a blank page, no server 500, no indication of the problem.
Without seeing your code, there are several things you need to consider when adding Javascript. The most obvious is the use of \n because \n serves the same function in perl as in Javascript. So if you have Javascript code like this,
$js = "var msg = 'The email field is blank.\n Please fill in the email field.';";
You need to use \\n to make sure it gets to the browser as \n.
The other and more dangerous problem is the use of the unbroken pipe (¦ <-- this will show as a broken pipe on this board, I am referring to the unbroken one.) In Javascript and perl this means a logical OR, but if incorrectly coded it can be interpreted by perl as an actual pipe command, which means to pipe data or other output to a program.
This should arm you with enough info to begin looking at your script and find the problem, but if you can't figure it out . . .
Post your code!
:-)
use CGI::Carp qw(fatalsToBrowser);
at the top of your program. This will print any error messages to the browser (they usually get lost because the browser only sees what gets printed to standard output - STDOUT -, whereas errors go to standard error - STDERR).
Simon