Solved

Position of javascript link and W3C xhtml compliance

Posted on 2010-09-05
6
388 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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'…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now