Dynamically setting display property reloads the window

Hi all:

I am currently encountering a problem with setting “display” property from “none” to “block”:

browsers will refresh itself when the display property is changed; this causes the element to display then suddenly disappear after the page reload. Do you guys have an idea what I can do to avoid it?

I tried using jquery’s show command, css command with setting display to block, and pure javascript method like document.getElementById(“theId”).style.display=“block”.

BTW, in IE9, the page reload even results in redirecting to the index page.

NVM guys, i figured it out.

Do not add href attribute to the element where you want to change the display property, cuz it will cause the browser to reload.

That occurs because the web browser is performing the default behaviour for that element.

Normally you can prevent that default behaviour by returning false from the function that handles the onclick event.