You got hacked. It's possible that they got your account info like Lowry said, maybe using a keylogger trojan. Could have been another way though.
Things to do -
Contact your host/admin and ask them to check all of your sites for the code (or do it yourself, if it's not a lot of pages) and clean them up. It's possible that the code is on other pages as well.
Update your AV software, preferably using more than one software for this, then run a thorough cleanup and then change your passwords to any hosting accounts (and pretty much to everything else).
Been there, done that