function clickbutton()
{
var ev = document.createEvent('MouseEvents');
ev.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
var button = document.getElementById('button');
button.dispatchEvent(ev);
}
clickbutton();