SilverBean
Programmer
I've got a cgi file in cgi-bin. This needs to run get some data from the database and post in a table. I'm revisiting my javascript-ing days and as the user interacts with this data in table form little bits of script run. Actually I've got a few things that really jazz things up - so doing without would be a real downer right now.
This is the cgi file (simplified to demonstrate problem):
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use constant TRUE => 1;
use constant FALSE => 0;
print "Content-type: text/html\n\n";
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \" \n";
print "<HTML><HEAD>\n";
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=iso-8859-1\">\n";
print "<TITLE>Hello</TITLE>\n";
print "<script type=\"text/javascript\" language=\"javascript\" src=\"chance.js\"></script>\n";
print "</HEAD><BODY>\n";
print "<form name=\"FormName\" action=\"(Empty Reference!)\" method=\"get\">\n";
print "<input type=\"checkbox\" value=\"checkboxValue\" name=\"chkPurchase\" ";
print "onclick=\"X1();\">\n";
print "</form>\n";
print "</HTML></BODY>";
#end of program
Problem is Perl(or somebody) does not like the src=. No matter what I put regardless of whether an actual file or not gives me errors. Gives me an object expected at line 58 Char 1. Which is the "<script type=" line. Want to try it? Try to check the box....go ahead......check the box.
Please be patient with netfirms they give the free sites low priority for cgi time you may get a try back message. Don't have to wait the full five minutes. No matter what I put for src= get the same error. Try a stupid non-existent file still error. Try the thing still error. I've tried this on my local Perl/CGI server and also my paid for real stuff at netfirms still same. Locally I'm running Apache probably older, but gotta believe the netfirms is a pretty up to date. Can't believe its quirking server thing. Seeing in IE V6.0 -- could it be a browser thing?
The kicker? If you have the capability to run the cgi locally. Give it a shot. When the browser brings up the CGI and you click on the check box error occurs on the page fine. Now do a view source save as htm. Then open it your browser and as a htm file(output of the cgi code) check the box thing works fine.
BTW: chance.js is
function X1()
{
window.alert("Hey you clicked on ");
}
Maybe I forgot some real simple JS thing?
My gut feeling is that its a Perl server thing. That is inherently when requests are made to access a file in the cgi-bin the server is really looking for cgi code. I even tried just renaming the file to cgi. I also tried changing the privileges of the JS RWE for everybody including my Uncle
On the other hand it looks like the src attribute is just not working which I can't believe did alot of searches haven't seen anything that obvious. Seems like double redundant to be coding JS in amongst my Perl with print statements. In line java for the above works fine, but I've got a good amount of JS to put in, and then if I do that make changes if I ever just want the JS stuff somewhere else I have to go back and weed it all out. So I'm just having a difficult time of passing this.
Any ideas?
This is the cgi file (simplified to demonstrate problem):
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use constant TRUE => 1;
use constant FALSE => 0;
print "Content-type: text/html\n\n";
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \" \n";
print "<HTML><HEAD>\n";
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=iso-8859-1\">\n";
print "<TITLE>Hello</TITLE>\n";
print "<script type=\"text/javascript\" language=\"javascript\" src=\"chance.js\"></script>\n";
print "</HEAD><BODY>\n";
print "<form name=\"FormName\" action=\"(Empty Reference!)\" method=\"get\">\n";
print "<input type=\"checkbox\" value=\"checkboxValue\" name=\"chkPurchase\" ";
print "onclick=\"X1();\">\n";
print "</form>\n";
print "</HTML></BODY>";
#end of program
Problem is Perl(or somebody) does not like the src=. No matter what I put regardless of whether an actual file or not gives me errors. Gives me an object expected at line 58 Char 1. Which is the "<script type=" line. Want to try it? Try to check the box....go ahead......check the box.
Please be patient with netfirms they give the free sites low priority for cgi time you may get a try back message. Don't have to wait the full five minutes. No matter what I put for src= get the same error. Try a stupid non-existent file still error. Try the thing still error. I've tried this on my local Perl/CGI server and also my paid for real stuff at netfirms still same. Locally I'm running Apache probably older, but gotta believe the netfirms is a pretty up to date. Can't believe its quirking server thing. Seeing in IE V6.0 -- could it be a browser thing?
The kicker? If you have the capability to run the cgi locally. Give it a shot. When the browser brings up the CGI and you click on the check box error occurs on the page fine. Now do a view source save as htm. Then open it your browser and as a htm file(output of the cgi code) check the box thing works fine.
BTW: chance.js is
function X1()
{
window.alert("Hey you clicked on ");
}
Maybe I forgot some real simple JS thing?
My gut feeling is that its a Perl server thing. That is inherently when requests are made to access a file in the cgi-bin the server is really looking for cgi code. I even tried just renaming the file to cgi. I also tried changing the privileges of the JS RWE for everybody including my Uncle
On the other hand it looks like the src attribute is just not working which I can't believe did alot of searches haven't seen anything that obvious. Seems like double redundant to be coding JS in amongst my Perl with print statements. In line java for the above works fine, but I've got a good amount of JS to put in, and then if I do that make changes if I ever just want the JS stuff somewhere else I have to go back and weed it all out. So I'm just having a difficult time of passing this.
Any ideas?