Here is some Javascript embedded into a Joomla Page using the Sourcerer plugin
{source}
<?php
$myscript = "alert('This is JavaScript');";
$doc->addScriptDeclaration( $myscript );
?>
{/source}
This will add it to the <head> of the document. If you just want the javascript code in the <body> of the document, just put the raw javascript inside the source tags, where you want it in the document. You need to have the <script> and </script> also.
{source}
<script type="text/javascript">
document.write('This text is placed through <strong>JavaScript</strong>!');
</script>
{/source}