如何将动作分配给perl cgi中的按钮?

时间:2013-06-06 06:44:32

标签: perl email button textbox cgi

所以我的CGI Perl中有一个按钮。在单击该按钮时,我需要在perl CGI中分配一个动作,在单击该按钮时,新的文本区域应该在具有提交按钮的同一页面中以指定的宽度打开。请帮我说说如何继续。这段代码对我来说并不适用。点击提交按钮,我将邮件通过电子邮件发送到电子邮件ID

这里我打印按钮

print button('email',"email me","reqts()");

这是opentextarea子程序

sub reqts {

   print "<p><em>Enter your Message here</em><br>";
   print textarea(-name=>'Comments',
                      -rows=>10,
                      -columns=>50);
   print submit('Action','Send');

}

单击此按钮时,子程序不会被调用。

此按钮位于另一个子程序

中的html表单上
sub actions {
print
  start_html(),
  start_form(-action => 'com.pl'),
  submit(-name => 'submit', -value => 'View com.pl'),
   end_form,
  print button('email',"email me","reqts()"),   # this is the button
  start_form(-action => 'about.pl'),
  submit(-name => 'submit', -value => 'About Us');
  end_form,
  end_html;
}

1 个答案:

答案 0 :(得分:1)

onClick属性(button的第三个参数)应该是JavaScript函数,而不是Perl函数。您应该研究CGI和网页的工作原理。