code by from1to9
tested in chrome