March 23, 2012

Javascript stop execution abort or exit

Question by Rocky111

if(a.value==1 && b.value==2)
{
    try{callFunc()  }catch(e) {} 
}
frm.submit();

inside function callFunc() what i have to write so that execution completly stops
it should not execute frm.submit();

function callFunc()
{
    //stop execution here ensure it wont execute fm.submit()
}

Answer by Starx

Cant you just do this?

if(a.value==1 && b.value==2) {}
else {
    frm.submit();
}

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!