Enjoy an ad free experience by logging in. Not a member yet?
Register .
04-20-2009, 12:35 AM
PM User |
#1
New to the CF scene
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Javascript within CGI, onClick events
Hi I'm writing a CGI script that creats a HTML page. On the buttons the CGI script creates I need to invoke a function in the OnClick event. I need to call one function multiple times however I get the error " ')' expected " but the calling of the function works from the onclick event when I call it once. Here's the code that causes the error:
Code:
while (fgets(pref, 5, fp)) {
getc(fp); // space
fgets(ptype, 4, fp);
getc(fp); // space
fgets(pname, 56, fp);
getc(fp); // space
fgets(price, 7, fp);
getc(fp); // space
fgets(delay, 4, fp);
getc(fp); // space
fgets(stock, 4, fp);
getc(fp); // space
fgets(altref, 5, fp);
fgets(line, 80, fp); // trailing spaces and newline char
printf("<tr>");
printf("<td>"); printf(pname);
printf("<td>"); printf(ptype);
printf("<td>"); printf("£");printf(price);
printf("<td>"); printf("<input type='Button'id=%i value='View' align='middle' onclick='cat2(); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat1();'>", temp, pref, pname, ptype, price, stock, delay, altref);
printf("</td>");
printf("</tr>");
temp++;
}
The function I need to call mutilple times is cat(%s), is my syntax wrong?
Last edited by sudsey; 04-20-2009 at 12:44 PM ..
Reason: grammer mistake
04-20-2009, 04:09 PM
PM User |
#2
Super Moderator
Join Date: May 2005
Location: Southern tip of Silicon Valley
Posts: 2,753
Thanks: 2
Thanked 149 Times in 144 Posts
sudsey,
You posted your question in the Perl forum, but that's not Perl code. Did you mean to post it in the php or Javascript forum?
04-20-2009, 06:05 PM
PM User |
#3
New to the CF scene
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
I'm sorry but I thought this was perl/CGI?
My code is javascript embedded in CGI, hence why the code has to be within Printf statements,
04-20-2009, 06:41 PM
PM User |
#4
Senior Coder
Join Date: Mar 2006
Posts: 1,274
Thanks: 2
Thanked 39 Times in 38 Posts
Its still a javascript question. Perl can only generate the document that the javascript is embedded in, like an html document. But it has nothing to do with execution of the javascript, whcih is the browsers responsibility. It would only be a perl/CGI question if the perl code was having a problem. Does the javascript work if you just copy and paste it into a static html page?
04-21-2009, 10:54 AM
PM User |
#5
New to the CF scene
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
No, it doesn't. It's serverside. Don't Worry problem solved.
04-21-2009, 01:07 PM
PM User |
#6
Master Coder
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
Quote:
Originally Posted by
sudsey
I'm sorry but I thought this was perl/CGI?
My code is javascript embedded in CGI, hence why the code has to be within Printf statements,
Quote:
Originally Posted by
sudsey
No, it doesn't. It's serverside. Don't Worry problem solved.
you don't know what language is but is solved? that's weird.
regards
04-21-2009, 05:06 PM
PM User |
#7
Senior Coder
Join Date: Mar 2006
Posts: 1,274
Thanks: 2
Thanked 39 Times in 38 Posts
Quote:
Originally Posted by
sudsey
No, it doesn't. It's serverside. Don't Worry problem solved.
If you say so.
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 04:36 AM .
Advertisement
Log in to turn off these ads.