473,545 Members | 318 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

direct javascript deprecated?

At http://www.quirksmode.org/js/placejs.html
I found a discussion on how & where to place your javascript.

Toward the bottom of the page, PPK has a section titled Deprecated:
Direct JavaScripts, with a small blurb that says "Do not use direct
JavaScripts. This section is only maintained for historical reasons."

For clarity, he is referring to a practice like:

<script type="text/javascript">
// Some javascript here
</script>

So - this is deprecated? This is something that shouldn't be done?

I can think of many instances where this would be the only way to
accomplish some things, and at least a few where it is a preferable
solution to loading & executing a script from an external file.

So - is this really deprecated? Or is the information presented
innacurate? Or perhaps something in between?
Apr 12 '06 #1
3 2814
VK

Tony wrote:
At http://www.quirksmode.org/js/placejs.html
I found a discussion on how & where to place your javascript.

Toward the bottom of the page, PPK has a section titled Deprecated:
Direct JavaScripts, with a small blurb that says "Do not use direct
JavaScripts. This section is only maintained for historical reasons."


That is a la W3C text (by style, not by origin). I mean it is not
enough to read it: you need also decrypt the intended sense out of bad
wording and typos.

Of course <script> is not deprecated.

The relevant section is called "Deprecated : Direct JavaScripts", and
the note referes to the section's title. Must read:
"Do not use "Direct JavaScripts" recommendations for <script> tag
syntax. This section is only maintained for historical reasons."

In this form it is correct, because this legacy part refers to the
"language" attribute and the "hide the script" comment trick.

P.S. Overall <http://www.quirksmode. org> is good source of info; it
suffers a bit of standards' maximalism and "Micro$oft must die!" stuff,
but the overall quality of materials is high.

Apr 12 '06 #2
On 12/04/2006 19:21, Tony wrote:
At http://www.quirksmode.org/js/placejs.html
[snip]
<script type="text/javascript">
// Some javascript here
</script>

So - this is deprecated? This is something that shouldn't be done?
The exact code that's demonstrated is deprecated; it features the
language attribute and SGML comments. However, I agree that that doesn't
appear to be the focus of the term 'deprecated'.

No, embedded scripts are not deprecated, however I do support the
sentiment of using external files where practical, especially for large
or reusable code.

[snip]
Or is the information presented innacurate? Or perhaps something in
between?


It's certainly inaccurate in some respects, but it seems to suffer more
from age than anything else. The information in the FAQ Notes[1] is most
definitely better.

Mike
[1] <http://www.jibbering.c om/faq/faq_notes/script_tags.htm l>

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Apr 12 '06 #3
VK wrote:

That is a la W3C text (by style, not by origin). I mean it is not
enough to read it: you need also decrypt the intended sense out of bad
wording and typos.

Of course <script> is not deprecated.

The relevant section is called "Deprecated : Direct JavaScripts", and
the note referes to the section's title. Must read:
"Do not use "Direct JavaScripts" recommendations for <script> tag
syntax. This section is only maintained for historical reasons."

In this form it is correct, because this legacy part refers to the
"language" attribute and the "hide the script" comment trick.
Ah - that makes more sense, then :) It didn't come across quite that
clearly, and I'm used to getting good info from PPK
P.S. Overall <http://www.quirksmode. org> is good source of info; it
suffers a bit of standards' maximalism and "Micro$oft must die!" stuff,
but the overall quality of materials is high.


I have found it to be a very useful resource
Apr 12 '06 #4

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

Similar topics

3
2016
by: annon | last post by:
I've noticed that some problems come up frequently that are of importance in writing web pages, because they're pretty fundamental points. For general reference, here are some collected solutions. 1. Opens a new Window at maximum size: window.moveTo(0,0,screenX=0,screenY=0) window.resizeTo(screen.availWidth+2,screen.availHeight+6)
6
1947
by: Mark Pappert | last post by:
I've got a linked 'common.js' file that contains one function, on IE and Firefox everything works as expected. However, Opera generates the following error: http://www.mdocs.ca/scripts/common.js Unknown context Syntax error while loading (line 61) -^
2
7418
by: Cy | last post by:
Hi, I have a menu that toggles correctly in IE but is failing in FireFox V.1 and Netscape 7.1. The FireFox JavaScript Console is returning the following error; Error: document.getElementById(showDiv) has no properties. Any advice would be much appreciated. Here is the snippet of applicable code; <script language="javascript">
7
1852
by: JSNewbie | last post by:
I am new to javascript. I used the code below in Netscape 7.0 and in IE 6.0. The Javascript portion does not render in Netscape , but it does show in IE. Can someone explain why? Any helpful insight would be appreciated. <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> <html xmlins="http://www.w3.org/1999/xhtml"> <head>...
1
3838
by: jarit | last post by:
Hi, Found these coding guidelines for C#, HTML, Javascript, Java, HTML, PL/SQL, T-SQL, VB and VBScript. Well written and free to download. www.demachina.com/products/swat Jeroen
3
5704
by: mbasil7 | last post by:
Hi at all! I want to use a javascript variable in php. The reason is that i want to know the client's screen resolution. Keep in mind that i am not a javascript programmer but php. Here is the code i'm using: <head> <script language='JavaScript'>
5
9455
by: Nadav | last post by:
Hi, I am trying to get a direct pointer to the address of the screen ( something like 0x0b00 in the happy DOS days ), how can I do that? Should this be done in the kernel or it can also be done in the App layer? Is there a contant base address to the screen memory? What API should I use? ThanX Nadav
7
4504
by: Jean Pierre Daviau | last post by:
I tried this in iexplorer, mozilla, opera. var in = 1; switch( in ){ case 1: in = "-1-"; break; case 2:
78
3332
by: Jeremy J Starcher | last post by:
(Request for Discussion) I've put together a guide that I hope will help novice coders avoid the same hair pulling that I went through. I'm open for comments about it. Have I missed the mark on a point or two? Have I overlooked something? Is my basic goal flawed? Is code bad in so many different ways that I
0
7456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7649
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7802
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7410
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7744
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5320
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3437
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1869
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
692
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.