Loop Html Elements Javascript Function