473,382 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Using <script src> tag, is type required?


Folks,

Do I need to use the 'type' in the javascrpit external load request below?
Is it mandatory or optional? I've not found a clear reference on this...

<script language='JavaScript' type='text/javascript' src=/myScrpit.js>

thanks... replies via ng only please
randelld
Jul 20 '05 #1
4 2002


Randell D. wrote:
Do I need to use the 'type' in the javascrpit external load request below?
Is it mandatory or optional? I've not found a clear reference on this...

<script language='JavaScript' type='text/javascript' src=/myScrpit.js>


If you want to write HTML according to the HTML 4.01 standard then you
need to have a type attribute for your <script> elements (any <script>
element not only those having a src attribute).

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
"Randell D." <re**********************@and.share.com> writes:
Do I need to use the 'type' in the javascrpit external load request below?
"need" is vague :) Will it work without it? Probably in some browsers,
maybe even all. But ...
Is it mandatory or optional? I've not found a clear reference on this...
It is required by the HTML 4 specification. Check
<URL:http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1>
---
type %ContentType; #REQUIRED -- content type of script language --
---
<script language='JavaScript' type='text/javascript' src=/myScrpit.js>
The "language" attribute is not needed, and it is deprecated in favor
of "type".
thanks... replies via ng only please


Ofcourse :)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3
Martin Honnen wrote:
<script language='JavaScript' type='text/javascript' src=/myScrpit.js>


If you want to write HTML according to the HTML 4.01 standard then you
need to have a type attribute for your <script> elements (any <script>
element not only those having a src attribute).


You also need to quote the value of the source attribute (it contains a "/"
so the quotes are not optional), and add a closing tag.

--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #4

Thanks to all for clarifying usage...

Cheers
randelld
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
by: Toni Mcintyre | last post by:
i'm having 2 problems with the http://validator.w3.org 1. if i have: <meta http-equiv="Content-Script-Type" content="text/javascript"> then why do i need <script type=text/javascript>...
2
by: Jeffrey T. | last post by:
I had some JavaScript functions defined in the <SCRIPT> section at the top of an aspx page (tested fine there). I then moved the JavaScript functions to their own separate file and then...
21
by: hemant.singh | last post by:
Hello all, I am try'g to send window.location.href to the server script who will generate dynamic javascript according to the referral name comg in as param Now bcz <script language="javascript"...
12
by: Iddo | last post by:
Hi, I am having a strange problem... I have an HTML file which has 2 script tags: 1) <script language="javascript" id="ABC" src="ABC.js" /> 2) <script id="general" language="javascript">...
44
by: rhythmace | last post by:
W3C HTML validator passes this: .... <script type="text/javascript" src="foo.js"> <script type="text/javascript"> ....script in here... </script> ....
2
by: Rolf Welskes | last post by:
Hello, I have simple in one folder FolderA MyMaster.master and script01.js styles01.css The content pages are in
3
by: joe | last post by:
Is it OK to have multiple: <script type="text/javascript" src="funcs1.js"></script> <script type="text/javascript" src="funcs2.js"></script> <script type="text/javascript"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.