У меня есть гиперссылка, которая должна вызывать 3 функции JS по одной во время события onclick.
<form name = "bulkcontactfrm" method="POST" action="<%= servletPath %>>
<div id="saveDiv" layoutAlign="top" style="display:block;">
<table id="" align="left" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="javascript:void(0);" onclick="isAllowedToResubscribe(document.bulkcontactfrm); manipulateDIV(document.bulkcontactfrm); resubscribeCall(document.bulkcontactfrm);"> Re-Subscribe</zoniac:roundrect> </a>
</td>
</tr>
</table>
</div>
<div id="loadingDiv" class="cellWhiteBGFont" layoutAlign="top" style="display: block;"><p><img src="<%=ImageMappingManager.getImageName("imgLoading")%>" name = "b1"> <font size='3'><b>Please wait...<b></font></p>
</div>
</form>
Вот функции JS:
// First function validate the data using ajax call
function isAllowedToResubscribe(form) {
//Client validation takes here
processAjaxRequestPost('ajaxRequestPost','SimpleHandler','getResubscribeEmailValidationDetails',emilIDStr,sourcefromStr);
}
// Second function hide the content in UI and show the Processing image in <DIV> tag
function manipulateDIV(form) {
hideSaveDiv();
showLoadingDiv();
}
function hideSaveDiv() {
//hide the Re-Subscribe hyperlink
document.getElementById('saveDiv').style.display='none';
}
function showLoadingDiv() {
//show the Processing image
document.getElementById('loadingDiv').style.display='block';
}
// Third function is for form submit using ajax call
function resubscribeCall(form) {
//processAjaxRequestPost('ajaxRequestPost','SimpleHandler','getResubscribeEmailDetails',emilIDStr,sourcefromStr);
}
После того, как щелкните вызов функции проверки гиперссылки и получите успех, появится сообщение о подтверждении, нажмите OK на подтверждении. Но тег <DIV>
не был скрыт, поэтому изображение прогресса не загружается.