PDA

View Full Version : Want to learn about resources and include .js files


johnbdh
12-25-2002, 05:40 PM
I am looking at the website carpoint.com and see the following in the source...

<script src="/include/listbox.js"></script>
<script src="/include/mmJava.js"></script>
<script src="/resources/mmUsed.js"></script>
<script src="/resources/mmNew.js"></script>

I am new to js programming and would like to learn how they are handling the Make and Model drop down lists on the client side. I have learned to do this by genereating js functions on load that fill the ddls with all the data imbedded in the script. The way carpoint is doing it seems so much more efficient.

I have figured out that mmUsed.js and mmNew.js create the arrays that are used to fill the ddls and I think that listbox and mmJava contain the funtions that do the work.

Can someone just point me to a good resource that will help me learn about creating and using .js files. I am in the process of learning how to work with arrays in js.

Thanks.

John

Mr J
12-25-2002, 07:23 PM
A Simple Example Would Be.

A script contains .....

<script>
function blah(){
things to do
}
</script>


Doing this as a .js file ......


function blah(){
things to do
}


You would save the .js file as ......

myname.js

(myname can be any of your choosing)

then access the .js file within your html doc as ....


<script language="javascript" src="myname.js"></script>

johnbdh
12-27-2002, 06:19 PM
Thanks for ther responses. So simple...


John