HighDots Forums  

.js files

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss .js files in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
PompeyFan
 
Posts: n/a

Default .js files - 08-05-2004 , 10:56 AM






When creating a rollover image, I would like to store the javascript in an
external [.js] file - is there anyway that the code can immediately be saved to
the file, or do you have to simply cut and paste the code into a created .js
file from the Code Window.

If there were 3 links each with a rollover state would it be necessary to save
the script to 3 different js files or can they all be placed into the same
file? When placing code within a .js file do I literally just paste it in? Is
there anything else that needs to be placed within the file?

I'd be most grateful for anyones assistance.




Reply With Quote
  #2  
Old   
Justin Kozuch
 
Posts: n/a

Default Re: .js files - 08-05-2004 , 11:25 AM






Hi There,

Well, you are in luck!!!

http://www.communitymx.com/abstract.cfm?cid=A3A8D

This free article, written by Jim Babbage, has everything you need to
know on how to externalize your JS files.

Enjoy!

--
Cheers,

Justin Kozuch
Founder, Dreaming in TO
Netkeepers.ca - Proud Hosting Sponsor of DreaminginTO.com Dreamweaver MX
2004 Certified Developer - http://www.macromedia.com/go/certification
Team Macromedia Volunteer for Dreamweaver MX 2004 -
http://www.macromedia.com/go/teammacromedia
CommunityMX Partner - http://www.communitymx.com

PompeyFan wrote:

Quote:
When creating a rollover image, I would like to store the javascript in an
external [.js] file - is there anyway that the code can immediately be saved to
the file, or do you have to simply cut and paste the code into a created .js
file from the Code Window.

If there were 3 links each with a rollover state would it be necessary to save
the script to 3 different js files or can they all be placed into the same
file? When placing code within a .js file do I literally just paste it in? Is
there anything else that needs to be placed within the file?

I'd be most grateful for anyones assistance.

Reply With Quote
  #3  
Old   
Al Sparber- PVII
 
Posts: n/a

Default Re: .js files - 08-05-2004 , 01:50 PM



PompeyFan wrote:
Quote:
When creating a rollover image, I would like to store the javascript
in an external [.js] file - is there anyway that the code can
immediately be saved to the file, or do you have to simply cut and
paste the code into a created .js file from the Code Window.

If there were 3 links each with a rollover state would it be
necessary to save the script to 3 different js files or can they all
be placed into the same file? When placing code within a .js file do
I literally just paste it in? Is there anything else that needs to
be placed within the file?

I'd be most grateful for anyones assistance.
If you want an automated way of doing this, check out our Productivity
Tools:
http://www.projectseven.com/products/prodtools/tools_01/index.htm

They are not free, but it includes a utility that not only allows you to
automatically create an external script file and move your scripts to
them, but it also allows you to move scripts back and forth from the
external file to your document and back again. This is handy when you
need to update scripts.

But here is the short answer if you'd like to do it yourself:
Create a new file with the JS extension: myscripts.js
Copy your JavaScript into this new file - do not include the <script>
tags:

<script type="text/javascript">
<!--
Copy only what is inside the tags and comments
//-->
</script>

Delete the scripts, the script tags, and the comments from your html
page and replace all of that with a link to the script file:

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

--
Al Sparber - PVII
http://www.projectseven.com
DW Extensions - Menu Systems - Tutorials - CSS FastPacks
---------------------------------------------------------
Webdev Newsgroup: news://forums.projectseven.com/pviiwebdev/
CSS Newsgroup: news://forums.projectseven.com/css/
RSS/XML Feeds: http://www.projectseven.com/xml/






Reply With Quote
  #4  
Old   
Justin Kozuch
 
Posts: n/a

Default Re: .js files - 08-05-2004 , 03:20 PM



Just remembered something.

http://sandbox.dreaminginto.com/includes/index.php

I did a test suite for an issue I had at work, and this is what I came
up with.

A bit more involved than Jim's article, but works nonetheless.

--
Cheers,

Justin Kozuch
Founder, Dreaming in TO
Netkeepers.ca - Proud Hosting Sponsor of DreaminginTO.com Dreamweaver MX
2004 Certified Developer - http://www.macromedia.com/go/certification
Team Macromedia Volunteer for Dreamweaver MX 2004 -
http://www.macromedia.com/go/teammacromedia
CommunityMX Partner - http://www.communitymx.com

PompeyFan wrote:

Quote:
When creating a rollover image, I would like to store the javascript in an
external [.js] file - is there anyway that the code can immediately be saved to
the file, or do you have to simply cut and paste the code into a created .js
file from the Code Window.

If there were 3 links each with a rollover state would it be necessary to save
the script to 3 different js files or can they all be placed into the same
file? When placing code within a .js file do I literally just paste it in? Is
there anything else that needs to be placed within the file?

I'd be most grateful for anyones assistance.

Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.