Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Externally Linking JS
Old 08-20-2006, 07:54 AM Externally Linking JS
dannyisonfire's Avatar
Average Talker

Posts: 22
Location: Hartlepool
Trades: 0
I know its possible to link to a css file using:

<link rel="stylesheet" href="/style.css">

Is there a way to do this, to link to a .js file, and if so how.

Thanks.
__________________

Please login or register to view this content. Registration is FREE
dannyisonfire is offline
Reply With Quote
View Public Profile Visit dannyisonfire's homepage!
 
 
Register now for full access!
Old 08-20-2006, 03:02 PM Re: Externally Linking JS
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
<script type="text/javscript" src="yourscript.js"/>
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 08-25-2006, 10:13 AM Re: Externally Linking JS
JA1
JA1's Avatar
Novice Talker

Posts: 6
Name: Jane Alford
Location: Meath, Ireland
Trades: 0
remember the trailing </script> otherwise your browser will stuff up!

<script type="text/javscript" src="yourscript.js"/></script>


J.
JA1 is offline
Reply With Quote
View Public Profile
 
Old 08-25-2006, 10:28 AM Re: Externally Linking JS
saadatshah's Avatar
Extreme Talker

Posts: 215
Name: Syed Saadat Ali
Location: Lahore, Pakistan
Trades: 0
<script language="javascript" src="abc.js" type="text/javascript"></script>
__________________
- -- --- ---- ----- ------ ------- ---------------
If you have knowledge, let others light their candles in it.
saadatshah is offline
Reply With Quote
View Public Profile Visit saadatshah's homepage!
 
Old 08-25-2006, 11:11 AM Re: Externally Linking JS
JA1
JA1's Avatar
Novice Talker

Posts: 6
Name: Jane Alford
Location: Meath, Ireland
Trades: 0
ah, such are the joys of cut 'n' paste
JA1 is offline
Reply With Quote
View Public Profile
 
Old 08-25-2006, 12:09 PM Re: Externally Linking JS
saadatshah's Avatar
Extreme Talker

Posts: 215
Name: Syed Saadat Ali
Location: Lahore, Pakistan
Trades: 0
Not mentioning the script language may cause problem in old browsers I guess what you say JA 1
__________________
- -- --- ---- ----- ------ ------- ---------------
If you have knowledge, let others light their candles in it.
saadatshah is offline
Reply With Quote
View Public Profile Visit saadatshah's homepage!
 
Old 08-25-2006, 07:00 PM Re: Externally Linking JS
kIDJOE's Avatar
Extreme Talker

Posts: 186
Location: Hollywood, CA
Trades: 0
Hide from old browser.. but hey who cares about super old browsers that wont call a JS?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

kIDJOE is offline
Reply With Quote
View Public Profile Visit kIDJOE's homepage!
 
Old 08-29-2006, 12:57 AM Re: Externally Linking JS
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
Quote:
Originally Posted by JA1 View Post
remember the trailing </script> otherwise your browser will stuff up!

<script type="text/javscript" src="yourscript.js"/></script>


J.

I used a self-closing tag (hence the / before the last > which is technically correct. Just like you can use <br/> Which browser will hang on that?

EDIT: OK, it is not valid HTML 4, but it is valid in XHTML. So I guess it depends which Doctype you're using

Last edited by funkdaddu; 08-29-2006 at 01:08 AM.. Reason: Found Answer
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 09-12-2006, 12:32 PM Re: Externally Linking JS
3rdShiftStudios's Avatar
Ultra Talker

Posts: 252
Name: Jaison Tortorea
Location: cincinnati, oh
Trades: 0
ok, i'm really new at this kinda of thing, can someone please give me a complete break down of where you put what and how to set up the remote file also?

my site in question is this: www.jaap-orr.com/link/index.html

I'd like the navigation along the top to be remote sourced and I just can't seem to find a point -by -point "how to" on it. I'm sorry to sound like a total noob but really i just don't get how to set up the references or the external file... thanks!
3rdShiftStudios is offline
Reply With Quote
View Public Profile Visit 3rdShiftStudios's homepage!
 
Old 09-12-2006, 04:34 PM Re: Externally Linking JS
Extreme Talker

Posts: 246
Trades: 3
If you're attaching an external JavaScript file, put the:

<script language="javascript" src="abc.js" type="text/javascript"></script>

between the <head> and </head> tags.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 09-12-2006, 10:19 PM Re: Externally Linking JS
3rdShiftStudios's Avatar
Ultra Talker

Posts: 252
Name: Jaison Tortorea
Location: cincinnati, oh
Trades: 0
Quote:
Originally Posted by CouponGuy View Post
If you're attaching an external JavaScript file, put the:

<script language="javascript" src="abc.js" type="text/javascript"></script>

between the <head> and </head> tags.
and denn? like i said, really need a whole discertation on how to set this up....

like what do i do for the buttons at the top? do i put their coding in the index page or on the js page?
3rdShiftStudios is offline
Reply With Quote
View Public Profile Visit 3rdShiftStudios's homepage!
 
Old 09-12-2006, 10:26 PM Re: Externally Linking JS
Extreme Talker

Posts: 246
Trades: 3
And then you can make the function calls in your buttons just like you are now. You would keep the buttons the same as they are now.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 09-12-2006, 10:43 PM Re: Externally Linking JS
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
Quote:
Originally Posted by funkdaddu View Post
I used a self-closing tag (hence the / before the last > which is technically correct. Just like you can use <br/> Which browser will hang on that?

EDIT: OK, it is not valid HTML 4, but it is valid in XHTML. So I guess it depends which Doctype you're using
I have been curious to this type of usage in xhtml 1.0. Is it OK to use a self closing tag (i.e. "/>") on tags that are commonly used with opening/ending tags?

Example - Are these valid?

<textarea />
<script />
<a name="section1" />


(what about my username, is that legal? - lol)
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 09-13-2006, 12:18 AM Re: Externally Linking JS
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
No, those don't validate as they are... they are missing attributes and not enclosed in a paragraph, form, etc... Use this and play around...
This does validate:
HTML Code:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

	<head>
		<title>Untitled Page</title>
		<script type="text/javascript" src="test.js"/>
	</head>

	<body>
	<p><textarea rows="20" cols="20"/></p>
	<script type="text/javascript" src="test.js"/>
	<p><a name="section1" /></p>
	</body>

</html>

Last edited by funkdaddu; 09-13-2006 at 12:21 AM..
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 09-13-2006, 05:19 PM Re: Externally Linking JS
Super Talker

Posts: 110
Name: Jason
Trades: 0
In order for Javascript to validate make sure you insert the doc type in the code.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

autoecart is offline
Reply With Quote
View Public Profile Visit autoecart's homepage!
 
Reply     « Reply to Externally Linking JS
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.45664 seconds with 12 queries