use strict; use warnings; use CGI::Pretty qw(:standard); print header, start_html( -title => 'CGI.pm and Javascript', -script => { -language => 'JAVASCRIPT', -code => q| function launch(select) { if (!select.value) return false; window.location.href = select.value; return false; } |, }, ), start_form, popup_menu( -name => 'jump_box', -onChange => 'launch(this)', -values => [qw( http://google.com http://perlmonks.com http://imdb.com )], ), end_form, end_html, ;