fix misuse of .attr()
fix js syntax error on IE7