This would be much easier if you would let us add events to the links, but try this anyway, it works by altering the submitted variable value when the form has been submitted successfully.
So, the first function checkform() is just a simple validation script, obviously I haven't included stacks of form controls, this is just to show that it works. If the form isn't completed when submit is clicked then the form won't submit. If the form is completed the form does submit, and the submitted variable is increased by 1, so it would now hold one.
The checkit() function is fired by the onunload event handler when the person tries to leave the page. The function first checks the submitted variable to see if it is equal to zero, if not then the script ends here and the person will navigate to the page they wanted to go to. If the variable is eqaul to zero then we know the user hasn't submitted the form. In this case a confirm dialog box appears which warns them that they should complete the form. If they click 'Cancel' then the confirm dialog box returns false, so the decided variable will hold false. In this case neither of the inner statements will evaluate to true so they will navigate to the page they choose as normal. You may not want that, but I believe the user should always be allowed to go if they want to. Now, If they clicked 'OK' then the decided variable would hold true, in which case we only need to decide how to proceed.
Now browsers handle the onunload event differently. When a link is clicked in IE, the current page stays the same until the script associated with the event runs, then the page will change. However under browsers like NN and Opera when the link is clicked the new page loads before the script runs. In either case we have to keep the user on the same page, so the script navigates the user accordingly.
var submitted = 0;
var thebrowser = navigator.appName
if (document.myform.yourname.value == "")
alert("Please complete the form")
if (submitted == 0)
decided = confirm("It is advisable that you complete and submit the form before leaving. Click OK to complete the form.")
if (decided == true && thebrowser == "Microsoft Internet Explorer")
location.href = location.href
else if (decided == true)
<a href="alink.html">a link</a><br>
<a href="anotherlink.html">another link</a>
<form name="myform" onsubmit="return checkform()" method="post" enctype="text/plain" action="mailto:email@example.com">
Your Name: <input type="text" name="yourname" size="30"><br>
<input type="Submit" value="Send Form" name="Submit">