我想在點擊'更新'按鈕之後顯示5秒鐘的警報消息,然後執行更新操作。顯示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);
但這是行不通的。爲什麼?
請試試這個:'setTimeout(timeout_trigger,5000);' – Cherniv
你想讓警報消息停留5秒,然後隱藏自己嗎? – higuaro
它仍然不顯示消息 – Armida