Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

JS in a CGI: unable to find a solution

by Discipulus (Canon)
on Feb 07, 2006 at 08:52 UTC ( [id://528449]=perlquestion: print w/replies, xml ) Need Help??

Discipulus has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: JS in a CGI: unable to find a solution
by izut (Chaplain) on Feb 07, 2006 at 10:39 UTC
    Something like this:
    print <<EOH; <html> ... <script> ... </script> <table> EOH my @items = ( { text => 'Text inside PopUp', name => 'This link', }, { text => 'Another text inside', name => 'Another link', }, ); foreach my $item (@items) { print <<EOT; <TR> <TD ALIGN="center"><A HREF="#" ONMOUSEOVER="popup('<font color=yel +low>$item->{'text'}</font>','green')" ONMOUSEOUT="removeBox()">$item- +>{'name'}</A></TD> </TR> EOT } print <<EOF; </table> ... </html> EOF
    You can also check CGI for a better cgi approach and Template-Toolkit for a higher level templating approach.

    Update: Added the @items array of hashes to have a better understanding.

    Igor 'izut' Sutton
    your code, your rules.

Re: JS in a CGI: unable to find a solution
by pajout (Curate) on Feb 07, 2006 at 11:59 UTC
    Though I am not a CGI expert, I have some recommendations. Firstly, you can try to edit your html code manually, to split your effort into getting your html-knowledge better and into your CGI knowledge. Secondly, your html problem is not really too much difficult, when you read something about SCRIPT element and /^onmouse/ events. I am using following spec,
    http://www.w3.org/TR/REC-html40/
    which is, imho, exact and human readable :) I prefer and advice to read a lot of specs rather than apply quick hack without real knowledge about it, because the spec reading lead us to know what we are doing...
Re: JS in a CGI: unable to find a solution
by shiza (Hermit) on Feb 07, 2006 at 18:20 UTC
    Check out JSAN (CPAN's younger cousin)
Re: JS in a CGI: unable to find a solution
by greywolf (Priest) on Feb 08, 2006 at 05:51 UTC
    My first thought is to create a single html page that contains the javascript you want to implement. No Perl at this point. When you get that working you should be able to cut and paste the solution into your CGI output. As a side note, that javascript looks real nasty. I assume it was generated by other software. That could be the source of your problem.


    mr greywolf

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://528449]
Approved by esskar
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 05:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found