<a onclick="test();"> add the return false in the javascript test function function test() { ... return false; }