EDIT: Sorry, I should have been more clear. My webpage must be XHTML compliant.
I use a hosted blogging platform and there is no way to host a JavaScript file on it. We usually refer to the JavaScript file on the web page as follows:
<script type='text/javascript' src='http://example.com/js/mycode.js'></script>
The question is, can I directly link to the code on the web page, not the file? If so, how to do it?
Just paste the JavaScript code into the file between the tags <script>
<script type='text/javascript'>
PASTE THE CODE FROM THE JS FILE HERE
</script>
OR how is it?
<script type='text/javascript'>
//<![CDATA[
PASTE THE CODE FROM THE JS FILE HERE
//]]>
</script>
Which of these two methods is correct? If not, is there a better way to do this?
Also, is it possible to link to a text file (.txt) inside the script tag, for example:
<script type='text/javascript' src='http://example.com/js/mycode.txt'></script>
or will there be any problems if I do it like this?
Looking for a helpful answer.