gert cuykens
11-02-2004, 07:38 PM
why does this not work ?
<link rel="javascript" type="text/javascript" href="script.js">
<link rel="javascript" type="text/javascript" href="script.js">
|
Click to See Complete Forum and Search --> : <link rel="javascript" type="text/javascript" href="script.js"> gert cuykens 11-02-2004, 07:38 PM why does this not work ? <link rel="javascript" type="text/javascript" href="script.js"> MstrBob 11-02-2004, 07:41 PM (1)This isn't a CSS question (2)Use this to include javascripts: <script type="text/javascript" src="script.js"></script> gert cuykens 11-02-2004, 07:44 PM sorry can i move it to javascript ? i know but i really would like to use <link> to point to a java script gert cuykens 11-02-2004, 07:48 PM ok i will make it on topic :) is it possible to use javascript or point to javascript inside a css file ? MstrBob 11-02-2004, 08:37 PM Not that I'm aware of, no. And you can't use link. As well as there's no advantage to using link. Jona 11-02-2004, 08:42 PM Originally posted by gert cuykens is it possible to use javascript or point to javascript inside a css file ? Only in Internet Explorer using the behavior property. Originally posted by MstrBob And you can't use link. As well as there's no advantage to using link. Correct. The LINK element imports CSS exclusively. There are no exceptions. toicontien 11-03-2004, 10:03 AM The link tag can also import a bookmark icon and an RSS Feed: <link rel="alternate" type="application/rss+xml" title="" href="" /> <link rel="shortcut icon" type="image/x-icon" href="xxx.ico" /> Jona 11-03-2004, 05:05 PM Originally posted by toicontien The link tag can also import a bookmark icon and an RSS Feed: <link rel="alternate" type="application/rss+xml" title="" href="" /> <link rel="shortcut icon" type="image/x-icon" href="xxx.ico" /> Sorry, I should have been more clear; I was speaking specifically of importing ASCII code for formatting, interaction or informational purposes. Thanks for clearing that up, though, in case anyone was confused by my statement. GhettoT 01-03-2007, 05:03 PM <script type="text/javascript" src="script.js"></script> I know this is a "dead" topic, but i must ask... Do you put that in the <BODY> or <HEAD> tags? toicontien 01-03-2007, 05:09 PM Either place. It's nice to keep all your SCRIPT importing tags in the head for code maintainability, but browsers really don't care all that much whether the SCRIPT tag importing a javascript file is in the HEAD or in the BODY. But it should BE in the HEAD or BODY. Never outside of those elements. GhettoT 01-03-2007, 05:12 PM OK, I knew they could go in either, but i was just wondering which is more prefered in the web world? I usually throw 'em in the <HEAD> but i know guys that put them in the <BODY> right before they call to the function in that script... holyhttp 01-03-2007, 06:42 PM If a javascript do not output anything (document.write('...'); ) it's best you keep it in the HEAD section. It's much a matter of keeping the HTML code in the body clean but the script tag can be inserted anywhere in your web page. Jona 01-03-2007, 10:48 PM Another issue regarding the location of the script importation tags regarding placement is failure of a script to execute due to its uninitialized state. For example, if you have an event handler that references a function defined in an external script and that external script is imported later in the document’s source code, you will receive a JavaScript error because that function is “undefined” as a result of its location. By keeping all imported, non-output scripts in the HEAD tags, you guarantee that no such mistake will occur, because these scripts will initialize before any output is applied to the web page. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |