Click to See Complete Forum and Search --> : loading like CSS
chris9902
07-25-2003, 01:28 PM
like with .CSS files you can load them a single line and a different file.
e.g. <link rel="stylesheet" href="text.css" type="text/css">
ok so can you do that with DHTML because i have a script that is like 200 lines long.
thanks for the help:)
David Harrison
07-25-2003, 02:04 PM
You can do this:
<script type="text/javascript" src="text.js"></script>
chris9902
07-25-2003, 02:06 PM
i don't no why but it did not work.
i have a .js file called text.js and added that to my body but nothing happened
David Harrison
07-25-2003, 02:08 PM
You're supposed to do it in the head section.
Edit:
If you've got a great big script that you want to put in the body in your .js file, then simlpy enclose it all in a function and put <script type=".... in the head and then in the body have:
<script type="text/javascript"><!--
the_function();
//--></script>
chris9902
07-25-2003, 02:10 PM
ok so how does it no were to add it to my body section
David Harrison
07-25-2003, 02:11 PM
I thought that you might ask that, so I edited my other post. Too late I guess.
chris9902
07-25-2003, 02:13 PM
i have no idea what you edited
what do i do?
do i add
<script type="text/javascript" src="text.js"></script>
in the head
then
<script type="text/javascript"><!--
the_function();
//--></script>
in the body:rolleyes:
chris9902
07-25-2003, 02:18 PM
ok i upload the .js file i don't really understand what you do.
how do i edit that file so it has a function... or whatever
then i think i add
<script type="text/javascript"><!--
the_function();
//--></script>
but edit "the_function();" part and add it to were i want it in my BODY
then i add
<script type="text/javascript" src="text.js"></script>
in the head
David Harrison
07-25-2003, 02:26 PM
OK, well for starters you don't have any active HTML in the .js file. Javascript only, so all of those <script language="javascript1.2">'s have got to go. Give me a minute to sift through the script and I'll try and get the deired effect.
chris9902
07-25-2003, 02:28 PM
yeah i have a HTML page and i want to linka .js file.
thanks for doing this i am really lost, i don't understand js at all
David Harrison
07-25-2003, 02:48 PM
This should work for ya:
chris9902
07-25-2003, 03:04 PM
that is fantastic, thanks so much:)
David Harrison
07-25-2003, 03:05 PM
Happy to help. :)