Jump to content

Javascript Files (script Src="...


RobberBaron

Recommended Posts

Files with the extension .js are real JavaScript files, so if you typed 'alert("Hi!")' and ran the file it would give the error "Line 1: Expression Expected". So when we link it with HTML (<script src="file.js">) does it really make a difference with the file type? I was making my own version of ASP written with JavaScript, and it would be useful to do <script src="file.asp">. So is this possible?

Link to comment
Share on other sites

The extension doesn't matter because you use the type attribute to tell the browser what kind of script it should be ready to parse:

<script type="text/javascript" src="file.ext"></script>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...