我想在点击“更新”按钮时显示警告消息5秒,然后执行更新操作。
my $cFunction = qq{
\$(document).ready(function(){
var w;
function closeWindow(){
setTimeout("w.close();", 3000);
}
function createWindow(){
//create the popup window.
w=window.open("","",'width=200,height=100');
// put something into the popup window
try{w.document.write('<html><head></head><body><p>Updating...</p></body> <html>')}catch(err){
//handle error here
}
closeWindow();
}
}
};
print $q->script($cFunction);
<--html form--->
$cInput_form .= $q->image_button({-src => '/media/images/save_1.png',-class => 'upd',-title => 'update', -name =>'Update', -value => $row_id, -onclick => 'createWindow()'});
print $q->fieldset ({-class => "ui-widget ui-widget-content"}, $cInput_form);
但这不起作用。为什么呢?