/    Sign up×
Community /Pin to ProfileBookmark

whats the difference between "text/javascript" and "javascript"

Hi there,

I found a neat little script on the web to do something and tried to implement it in my code, but no matter wut i did, i couldn’t get it to work and then i realized one difference.

The code i got starts like
<script type=”text/javascript”>

and my code starts like
<script language=”javascript”>

what exactly is the difference between the two and why use one over the other?? cause apparently some features that can be used when using <script type=”text/javascript”> can’t be used with using <script language=”javascript”>

thanks

to post a comment
JavaScript

13 Comments(s)

Copy linkTweet thisAlerts:
@7studFeb 09.2005 — old --> language="javascript"

new --> type="text/javascript"

cause apparently some features that can be used when using <script type="text/javascript"> can't be used with using <script language="javascript">[/quote]
Which ones?
Copy linkTweet thisAlerts:
@barayloogauthorFeb 10.2005 — nvm, im an idiot. I had something misspelled and i couldn't see it. Thanks for the reply though


so if <script type="text/javascript"> is new, then I should always be using that then instead of using <script language="javascript"> rite??
Copy linkTweet thisAlerts:
@scragarFeb 10.2005 — try to use both if nessesary, otherwise the separateion of the 2 can solve some problems regarding compatability.
Copy linkTweet thisAlerts:
@barayloogauthorFeb 10.2005 — ahh ok, i forgot about the fact that i can use both of em.

thanks guys
Copy linkTweet thisAlerts:
@FangFeb 10.2005 — Using the old --> language="javascript", will not validate
Copy linkTweet thisAlerts:
@barayloogauthorFeb 10.2005 — ---^^^ it will not validate wut??
Copy linkTweet thisAlerts:
@PittimannFeb 10.2005 — Hi![i]Originally posted by barayloog [/i]

[B]---^^^ it will not validate wut?? [/B][/QUOTE]
It will not [URL=http://validator.w3.org]validate your markup[/URL]. But if you use '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' as your DTD and have both attributes in your script tag:

<script language="JavaScript" type="text/javascript">

it will validate. Using only the language attribute will NOT validate.

Cheers - Pit
Copy linkTweet thisAlerts:
@barayloogauthorFeb 10.2005 — oh ok, thanks ?
Copy linkTweet thisAlerts:
@FangFeb 10.2005 — <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> is not [URL=http://www.w3.org/QA/2002/04/valid-dtd-list.html]valid[/URL]
Copy linkTweet thisAlerts:
@barayloogauthorFeb 10.2005 — hey I use Dreamweaver, and it puts this line in the doc. automatically, so i don't need to worry about this ?
Copy linkTweet thisAlerts:
@FangFeb 10.2005 — Also note that the use of [i]language[/i] is [URL=http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1]deprecated[/URL]
Copy linkTweet thisAlerts:
@PittimannFeb 10.2005 — Hi![i]Originally posted by Fang [/i]

[B]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> is not [URL=http://www.w3.org/QA/2002/04/valid-dtd-list.html]valid[/URL] [/B][/QUOTE]
I agree, but nevertheless: [URL=http://www.pit-r.de/scripts/dtd.htm]it validates[/URL].

Cheers - Pit
×

Success!

Help @barayloog spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...