HighDots Forums  

seperate javascript file-how to please ?

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss seperate javascript file-how to please ? in the Macromedia Dreamweaver forum.



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

Default seperate javascript file-how to please ? - 10-26-2005 , 08:33 AM






Using Deamweaver 4.0.
I have read search engine tutorials advising that javascript code should be
in a separate file off the page. Can someone explain how I do this please.
Am I right in thinking that I copy the script into say "notepad", call it
something like- filename.js, and then upload to server linking to relavent
page. If so, how do I link ?

For example most of my website pages have a lot of javascript code in the
header section such as
<script language="JavaScript">
<!--
<!--
function MM_swapImgRestore.......etc}
function MM_findObj...etc}
function MM_swapImage...etc}
function openPictureWindow_Fever.etc("","newWindow",".....e tc
function MM_openBrWindow}..etc
function MM_preloadImages() { //v3.0.....etc
//-->
</script>
==========================
An example would be good - your help much appreciated
Regards to all
John



Reply With Quote
  #2  
Old   
Murray *TMM*
 
Posts: n/a

Default Re: seperate javascript file-how to please ? - 10-26-2005 , 08:46 AM






Quote:
I have read search engine tutorials advising that javascript code should
be in a separate file off the page.
It's a good practice to do this, but it cannot affect your search engine
ranking.

Open notepad, paste this in -

function MM_swapImgRestore.......etc}
function MM_findObj...etc}
function MM_swapImage...etc}
function openPictureWindow_Fever.etc("","newWindow",".....e tc
function MM_openBrWindow}..etc
function MM_preloadImages() { //v3.0.....etc

Note - there is no HTML - only javascript function definitions.

Save the file in your site as external.js or something.

Then in the HTML page's head, do -

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

Be aware that in DW4, if you subsequently edit any behavior on the page that
javascript will get written BACK to the head. In addition, if you add any
new behaviors to the page, that js will also get written to the head.

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"JE" <je (AT) naturesfood (DOT) net> wrote

Quote:
Using Deamweaver 4.0.



Reply With Quote
  #3  
Old   
JE
 
Posts: n/a

Default Re: seperate javascript file-how to please ? - 10-26-2005 , 09:27 AM



Many thanks Murray...
=====================
"Murray *TMM*" <forums (AT) HAHAgreat-web-sights (DOT) com> wrote

Quote:
I have read search engine tutorials advising that javascript code should
be in a separate file off the page.

It's a good practice to do this, but it cannot affect your search engine
ranking.

Open notepad, paste this in -

function MM_swapImgRestore.......etc}
function MM_findObj...etc}
function MM_swapImage...etc}
function openPictureWindow_Fever.etc("","newWindow",".....e tc
function MM_openBrWindow}..etc
function MM_preloadImages() { //v3.0.....etc

Note - there is no HTML - only javascript function definitions.

Save the file in your site as external.js or something.

Then in the HTML page's head, do -

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

Be aware that in DW4, if you subsequently edit any behavior on the page
that javascript will get written BACK to the head. In addition, if you
add any new behaviors to the page, that js will also get written to the
head.

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"JE" <je (AT) naturesfood (DOT) net> wrote in message
news:djnt2l$145$1 (AT) forums (DOT) macromedia.com...
Using Deamweaver 4.0.





Reply With Quote
  #4  
Old   
Murray *TMM*
 
Posts: n/a

Default Re: seperate javascript file-how to please ? - 10-26-2005 , 09:41 AM



You're welcome.

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"JE" <je (AT) naturesfood (DOT) net> wrote

Quote:
Many thanks Murray...
=====================
"Murray *TMM*" <forums (AT) HAHAgreat-web-sights (DOT) com> wrote in message
news:djntqs$25i$1 (AT) forums (DOT) macromedia.com...
I have read search engine tutorials advising that javascript code should
be in a separate file off the page.

It's a good practice to do this, but it cannot affect your search engine
ranking.

Open notepad, paste this in -

function MM_swapImgRestore.......etc}
function MM_findObj...etc}
function MM_swapImage...etc}
function openPictureWindow_Fever.etc("","newWindow",".....e tc
function MM_openBrWindow}..etc
function MM_preloadImages() { //v3.0.....etc

Note - there is no HTML - only javascript function definitions.

Save the file in your site as external.js or something.

Then in the HTML page's head, do -

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

Be aware that in DW4, if you subsequently edit any behavior on the page
that javascript will get written BACK to the head. In addition, if you
add any new behaviors to the page, that js will also get written to the
head.

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"JE" <je (AT) naturesfood (DOT) net> wrote in message
news:djnt2l$145$1 (AT) forums (DOT) macromedia.com...
Using Deamweaver 4.0.







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.