JavaScript - external files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am not sure whether this is the right place for this...but here goes.

I have a site, built in FrontPage, some of the pages contain passages of
JavaScript.

The site has been reviewed by search engine consultants who have advised
putting the JavaScipt in external files. I can't seem to find any syntax for
doing it...but of course I may be looking in the wrong place.

Any Ideas? Thanks

Robert
 
Not sure why they told you that but:
This is an example of script within a page:

<script language="javascript">
function dothis(){
alert ("I did This");
}
function dothat(){
alert ("I did That");
}
</script>

To create an external js file, open notepad and place the following in it
and save it as filename.js
<!--
function dothis(){
alert ("I did This");
}
function dothat(){
alert ("I did That");
}
//-->

Then to call the js file from your page, assuming the js file is in the same
location as the page using it:

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



--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
Thanks for that..It's a great help

Robert

Steve Easton said:
Not sure why they told you that but:
This is an example of script within a page:

<script language="javascript">
function dothis(){
alert ("I did This");
}
function dothat(){
alert ("I did That");
}
</script>

To create an external js file, open notepad and place the following in it
and save it as filename.js
<!--
function dothis(){
alert ("I did This");
}
function dothat(){
alert ("I did That");
}
//-->

Then to call the js file from your page, assuming the js file is in the same
location as the page using it:

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



--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
Back
Top