Hello,
It is an issue with the default TinyMCE editor included with Joomla. It often strips certain coding elements natively, especially any type of scripts. We have a small Tutorial here about it:
http://www.shape5.com/documentation/Joomla/Editor-Stripping-Source-CodeYou can also alternatively use Global Configuration > Editor > None when modifying code heavy content or use another 3rd party editor called JCE which is very popular.