#!perl use CGI qw(:standard); use strict ; use warnings; my $query = new CGI; print $query->header; print start_html(-title=>"hello world", -bgcolor=>"#BOE0E6" ); my $js =< function check_answer() { if(document.hello.empcode.value==false) { alert("Please enter the Software"); document.hello.empcode.focus(); return false; } return true; } JS print "$js \n\n"; print $query->startform(-method=>"POST",-action=>"mycgi.cgi",-onSubmit=>'return check_answer()',-name=>'hello'); print $query->textfield(-name=>'empcode', -size=>20, -maxlength=>20); print $query->submit(-name=>'submit', -value=>'submit'); print $query->reset ; print $query->endform;