var x = document.getElementById("ff"); if (x != null) { x.submit(); } how to invoke a button using javascript