I have this code:
<html><head></head><body>
<script language="javascript" type="text/javascript">
function f(){
//WHAT I HAVE TO PUT HERE?
}
function unloadFCT() {
//CODE WHEN THE WINDOW IS UNLOADED
}
var val = navigator.userAgent.toLowerCase();
if(val.indexOf("msie") > -1){
window.attachEvent('onbeforeunload', unloadFCT);
}
else{
window.onunload = unloadFCT;
}
</script>
<a href="#" onclick="f()" >Call unloadFCT() function</a>
</body></html>
The goal of f() is to execute the code of unloadFCT().
Who can tell me what’s the code of f()?
/***********test1.php**********/
I create a simple example to understand the problem, Bellow is the content of test1.php file
When you close this window, a new file will be created in the same place as ajaxCall.php
/***********ajaxCall.php**********/
/***********test2.php****/
Execute the code of unloadFCT() function and close this window!!!
/*************Problem***********/
Can you please tell me what’s wrong in test2.php? I want the f() function to execute the code of unloadFCT() and close the current window.