Solved

Position of javascript link and W3C xhtml compliance

Posted on 2010-09-05
6
392 Views
Last Modified: 2012-05-10
I can add javascript anywhere within the html of a web page between tags <script language="javascript" type="text/javascript"> and </script> but can I move the javascript to a .js file and add a reference to the file within the html eg:  
<script src="includes/javascript/images.js" type="text/javascript"></script>
will this work if it's outside the head tags, and if so will it pass a W3C xhtml compliance test?
0
Comment
Question by:ncw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 3

Accepted Solution

by:
grantunwin earned 400 total points
ID: 33607301
Yes. I just tested it at:

http://validator.w3.org
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 33607314
Hi,
May i know whats the w3 validator has given u an issue.
It will work only if u provide the perfect path to it.
0
 
LVL 1

Author Comment

by:ncw
ID: 33607438
I just seem to remember that it caused me an error last time. I'll try it out.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 1

Author Comment

by:ncw
ID: 33607456
Is there anyway to hide the javascript from view source?
0
 
LVL 15

Assisted Solution

by:Insoftservice
Insoftservice earned 100 total points
ID: 33609004
HI,
But y u want to hide it.
whats the validator issue ur getting.
i don't think is there any way to hide it.
0
 
LVL 1

Author Closing Comment

by:ncw
ID: 33640936
As you say it works fine, thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question