PDA

View Full Version : the best way for opening javascript?



joonstar
04-16-2005, 02:52 AM
(1) <script type="text/javascript">

(2) <SCRIPT LANGUAGE="JavaScript">

(3) <script>


Which is the best practice for opening javascript?

if possible, could you tell my the reason in short?

_Aerospace_Eng_
04-16-2005, 03:12 AM
The first one is the best way for the script tag, reason being, the 2nd one has language="javascript" which is deprecated and shouldn't be used any more, and the 3rd one, you are missing the type attribute, which is needed if you want it o validate.

hemebond
04-16-2005, 05:44 AM
Option 1 is the only one you should use.

bfsog
04-16-2005, 07:14 AM
JavaScript is the default scripting language, so if you used




<script>
// code here
</script>



Your browser would know its JavaScript but the standard nowadays is the incode type="text/javascript"

joonstar
05-21-2005, 02:39 PM
(1) <script type="text/javascript">

(2) <script language="javascript">


Which is more recommendable between (1) and (2) in the above quote?

A1ien51
05-21-2005, 09:19 PM
as stated above, use 1 since language is deprecated.

joonstar
05-21-2005, 10:20 PM
(1) <script type="text/javascript">
(2) <script type='text/javascript'>


Which is more recommendable between double quotation mark and single quotation mark?

shnplr
05-22-2005, 05:16 AM
<script type="text/javascript">
...
</script>

OR

<script src="/myapp/afile.js" type="text/javascript"></script>

glenngv
05-23-2005, 09:25 AM
Which is more recommendable between double quotation mark and single quotation mark?
Just like in any other HTML attributes, use double quotes.