我想在单击更新按钮时显示一个窗口,此窗口应保持 3 秒,然后自动关闭结束执行更新操作。这是我的代码,但它不起作用
my $cScript = qq{
\$(document).ready(function(){
var w;
function closeWindow(){
setTimeout(function() {
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($cScript);
}
HTML 表单:
$cInput_form .= $q->image_button({
-src => '/media/images/save_1.png',
-class=>'btn btn-primary btn-large',
-title => 'update',
-name => 'Update',
-value => $row_id,
-onclick => "createWindow()"
});
print $q->fieldset ({-class => "ui-widget ui-widget-content"}, $cInput_form);
哪里有问题?