Your CPAN lead was helpful -thanks. FYI, the link http://home.netscape.com/eng/mozilla/2.0/handbook/javascript/ cited within the CPAN is defunct. Can you offer a viable url for the intended link?

Based on this, here's where i'm at. let's take something a bit more simple to work out my kinks between Perl and Javascript (using what was in CPAN).

a) it appears the javascipt must be put in-line with the Perl code as in the below code. I'd rather be able to keep the javascript separate if there is a way to do so...the major problem I see with this approach is the javascript source is printed out in it's entirety! It just clutters up the screen. So the first question, is how does one suppress the printout of the javascript?

b) second question, i want to reference the variable 'answer' inside the javascript and place it in the form textfield 'answer'

#! /usr/bin/perl -wT use CGI qw(:standard escapeHTML); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; print header (), my $JSCRIPT=<<END; // Ask a silly question function riddle_me_this() { var r = prompt("What walks on four legs in the morning, " + "two legs in the afternoon, " + "and three legs in the evening?"); response(r); } // Get a silly answer function response(answer) { if (answer == "man") alert("Right you are!"); else alert("Wrong! Guess again."); } END print start_html(-title=>'The Riddle of the Sphinx', -script=>$JSCRIPT); print p ("Element names & values submitted in previous form:"); my @names = param (); # get list of parameter names if (!@names) { print p ("(no elements present)"); } else { my @item = (); foreach my $name (@names) { my @val = param ($name); $val[0] = "[" . join (", ", @val) . "]" if @val > 1; push (@item, escapeHTML ("$name: ($val[0])\n")); } print ul (li (\@item)); } print hr (); print start_form (-action => url ()), p ("Enter riddle answer:", textfield (-name =>"answer", -id=>'response +1' -type=>"text", -size=>"30"), button(-name=>'riddle_button', -valu +e=>'Ask A Riddle', -onClick=>"riddle_me_this(response1)")), br(), p ("Enter your name:", textfield (-name =>"name", -type=>"text", -size +=>"30")), br(), submit (-name => "Submit Button", -value => "Submit"), reset (-name => "Reset Button", -value => "Reset"), end_form (); print end_html (); exit (0);

In reply to Re^3: obtaining yyyy-mm-dd via a calendar object by gmacfadden
in thread obtaining yyyy-mm-dd via a calendar object by gmacfadden

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.