views:

112

answers:

1

In HTML, are the <script> elements allowed to be external and use <script src="myscript.js"> even when in the <body> of the document?

+8  A: 

Yes. This is how a lot of widgets work like Google Maps. Make sure you specify the type though:

<script type="text/javascript" src="action.js"></script>
Matthew James Taylor
I thought you should specify the type even for scripts in the head section. Or is it somehow special for scripts inside the body?
dasha salo
You should always specify the type :)
Matthew James Taylor