Simple JS function doesnt work all the time?

Printable View