Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mattscott306

macrumors 68040
Original poster
Jan 16, 2007
3,769
0
Hey, I'm putting a really basic .js code in my pages, and rather than type up the code each time I want to just save it externally in an index. W3 Schools says you need to remove the <script> tags from the .js document, so I'm wondering if that means I should open up with:

<type="text/javascript">
or if I should open up with <script type="text/javascript">
and just leave off the </script> at the end.
 
You don't open (or close) with any <> tags in the .js document. Just include what you were normally containing within the <script> tags. For example, your file might start with a "var xyz = 'test';" or perhaps a "function function_name (param) {..."
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.