Is it illegal to remove the banners that most of free web hosting providers put on your page?
I can do it using some javascript code, but don't know if it's illegal or not.
Illegal? No. But is it against their terms of service? Oh, you bet. If you're caught, they'll surely terminate your account.
Ok.
I read somewhere, though, is that if you host your domain name on one of those free services, it's not against there terms to remove the banners. Is that true?
When you agree to their TOS, you agree to their TOS... It's a contract.
Yes, it's illegal
But there are many free web hosting providers that don't force place a banner.
http://www.redrival.com http://free.prohosting.com http://www.wiktor.dk http://www.freeshells.com