When you are working with html form, you might need this below javascript code to implement form reset and cancel features.

 <script type="text/javascript">
 function clearform(){
 if(confirm("Are you sure you want to reset the form?")){
 document.res_reg.reset();
 }
 }

function cancelAction() {
 var cancel=confirm("Are you sure you want to cancel?")
 if (cancel==true)
 {
 // Go back (Same result as pressing browser back button)
 history.go(-1);
 }
 else
 {
 <!-- nothing happens-->
 }
 }
 </script>
 <input type="button" value="Reset" onclick="clearform();return false" />
 <input type="button" value="Cancel" onclick="cancelAction();" />
 

[code]// This script sets OSName variable as follows:
// "Windows" for all versions of Windows
// "MacOS" for all versions of Macintosh OS
// "Linux" for all versions of Linux
// "UNIX" for all other UNIX flavors
// "Unknown OS" indicates failure to detect the OS[/code]

[code]var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
document.write('Your OS: '+OSName);[/code]