请使用 JQuery。 $("#loading").ajaxStart(function() { $(this).show(); }); $("#loading").ajaxStop(function() { $(this).addClass('ohmy').hide('slow'); });