Click to See Complete Forum and Search --> : <script> tag


Webskater
08-18-2003, 06:26 AM
Can anyone explain the difference please between:

<script>
AND
<script language=javascript>
AND
<script language=text/javascript>

Thanks.

Charles
08-18-2003, 06:39 AM
The first one is wrong and always wrong. The browser needs to know what scripting language is being used. The second is what you use if you are using HTML 3.2. The third is used with HTML 4.01, XHTML 1.0 and XHTML 1.1 except that "text/javascript" must appear in either single or double quotes and it's "type" not "language". In XHTML all attribute values must appear in quotes but in HTML ... From the HTML 4.01 Specification:
In certain cases, authors may specify the value of an attribute without any quotation marks. The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal 58). We recommend using quotation marks even when it is possible to eliminate them.
http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2You should be using HTML 4.01 if not XHTML and you should be using the Strict DTD.

I should add that if you use the "language" attribute then certain versions of Netscape will behave in a non-standard and unexpected way.

Webskater
08-18-2003, 06:54 AM
Thanks for your answer, Charles. How do I know which version of HTML I am using? I know that sounds daft.

You said the second should be used with HTML 3.2. The third is used with HTML 4.01. I just write html - but which version am I using?

What does Strict DTD mean?

Thanks again.

Charles
08-18-2003, 07:00 AM
Originally posted by Webskater
I just write html - but which version am I using?If you don't know what version you are using then you aren't writing HTML for an HTML document starts with a declaration of the version. You are usig bits and pieces of HTML to trick certain browsers into behaving in a certain way. If you use HTML 3.2 then your page will work on all graphical browsers but if you use HTML 4.01 Strict your page will work on all browsers, including Braille, audio and hand held browsers. See http://www.w3.org/MarkUp/ and read, mark, learn and inwardly digest the HTML 4.01 Specification.

Webskater
08-18-2003, 08:52 AM
Thanks again for your answer. I use FrontPage as my authoring tool. If I create a new page it puts:

<meta http-equiv="Content-Language" content="en-gb">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

The last tag states the content is "text/html" but there is no mention of a version. Where should this go please.

pyro
08-18-2003, 09:08 AM
To specify which version of HTML you are using, you use a doctype (http://www.webdevfaqs.com/html.php#doctype). Also, FrontPage is basically useless, if you want to program for anything other than IE. If you feel the need to use a WYSIWYG, pick up a copy of Macromedia Dreamweaver, or Adobe GoLive. I personally use DW (for it's great PHP support) and hard code most of my pages.

Webskater
08-18-2003, 01:02 PM
I would take issue with your statement that FrontPage is basically useless. I never use the WYSIWYG view, I always code in HTML view and I don't use any of the daft webbots. If you are programming in the Microsoft environment you might as well use it. It has lots of useful functionality when it comes to workgroup development. I've tried DW and an adobe product before GoLive - they're too graphic obsessed for my liking.

Khalid Ali
08-18-2003, 01:24 PM
I am sure there must be some template creation functionality in the frontpage.

creat a template that starts something like oneof these below


/***************** DOCTYPE DECLARATIONS *******************/

HTML4.01
The HTML 4.01 Strict DTD includes all elements and attributes that have not been deprecated
or do not appear in frameset documents. For documents that use this DTD, use this document
type declaration:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

---------------------------------------------------------------------------------------------

The HTML 4.01 Transitional DTD includes everything in the strict DTD plus deprecated elements
and attributes (most of which concern visual presentation). For documents that use this DTD,
use this document type declaration:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

----------------------------------------------------------------------------------------------

The HTML 4.01 Frameset DTD includes everything in the transitional DTD plus frames as well.
For documents that use this DTD, use this document type declaration:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">





XHTML1.0

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

pyro
08-18-2003, 01:28 PM
Originally posted by Webskater
I would take issue with your statement that FrontPage is basically useless.I was talking about the WYSIWYG aspects of the program. You can hard code in just about anything. I do believe, however, that FP does have a few bugs even when hard coding...