Konrad Den Ende wrote:
So, the recommended (and validating) way to write it would be:
<script type="text/javascript" src="yourscript file.js"></script>
I have placed following in the <head>
<script type="text/javascript" src="scripts.js "></script>
and made the script itself to a function returning a string as in
function getSome () { ... }
Then i call it by
<script>documen t.write (getSome ());</script>
but i get the message that the site is loaded but it contains errors.
I can't see the text i'm supposed to, either. What did i miss?
The scripting in the external .js file must be without opening and
closing HTML-tags
Also check if you can read the .js file directly from your server, maybe
you must update/change the index.cache files
If your browser says it contains errors, check out in which lines of
your page (in IE doubleclick on the yellow triangle)
I do it this way on a working site (eg. putting address info under each
page on
http://www.autowiegel.nl)
In HEADER:
<script src="data1.js" language="javas cript"></script>
in BODY:
<SCRIPT language="Javas cript">
<!--
document.write( voettxt1)
//-->
</script>
The data1.js file contains the following (you'll notice a function
inside it too, but you can of course remove it);
<!--
function newwin2(page) {
empty =
open(page,"empt y","width=630,h eight=470,statu s=0,scrollbars= 1,resizable=0,l ocation=0,menub ar=1,top=100px, left=100px");
}
var voettxt1 = "<HR><CENTER><T ABLE align=middle bgColor=#ffffff
border=0><TBODY ><TR><TD><FON T face=arial,helv etica size=-1>Auto Wiegel
B.V.<BR>Kortewe g 1<BR>2641 GZ Pijnacker<BR><A
href=javascript :newwin2('route map.htm')><FONT
color=blue>Rout ekaart</FONT></A></FONT></TD><TD
width=25> </TD><TD><FONT face=arial,helv etica size=-1><TABLE
border=0><TBODY ><TR><TD><FON T face=arial,helv etica
size=-1>Tel.<BR>Fax.< BR>E-mail.<BR>Intern et.</FONT></TD><TD><FONT
face=arial,helv etica size=-1>+31 (0)15 369 22 52<BR>+31 (0)15 369 60
29<BR>in**@auto wiegel.nl<BR>ww w.autowiegel.nl </FONT></TD></TR></TBODY></TABLE></FONT></TD></TR></TBODY></TABLE></CENTER>";
//-->
See the result on, for instance,
http://www.autowiegel.nl/pag02.htm
Richard