Why does my page reload after calling a function?

 function changeBGimage(){
    var imgSrc = new Array();
    imgSrc[0]="url('images/cons_1.png')";
    imgSrc[1]="url('images/cons_2.png')";
    imgSrc[2]="url('images/cons_1.png')";
    var no = Math.floor(Math.random()*2);
    var bg = document.getElementById("background");
    bg.bgColor="#ffccaa";
    //alert(bg.style.backgroundImage);
    bg.style.background=imgSrc[no];
   
    bg.style.backgroundRepeat="no-repeat";
    bg.style.backgroundPosition="0 0";
    bg.style.border="solid 1px"//bg.style.backgroundColor="#ffccaa";
    //alert(bg.style.backgroundImage);
    var i = 1;
    alert(i++);
    //new Date();
    
    
    

}

^I have the following function that I call onCLick, and after the function is called the page automatically reloads itself and makes the effect in null, is there something I a missing that causes this unnecessary re-loading of the page?