I want to send a parameter (string) to an external js file.
I found something very similar to what I wanted with you but it doesn't answer my question, so here goes:
I call my external js like this
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript" src="diapo.js"></script>
Expand|Select|Wrap|Line Numbers
- var special="images/34b"
- var seqslides=new Array()
- seqslides[0]=[special+".jpg"]
- seqslides[1]=[special+".jpg"]
- seqslides[9]=[special+".jpg"]
- seqslides[10]=[special+".jpg"]
- seqslides[18]=[special+".jpg"]
- seqslides[19]=[special+".jpg"]
- seqslides[2]=["images/more1.jpg"]
- seqslides[3]=["images/longbit_gdm.jpg"]
- seqslides[4]=["images/more2.jpg"]
- seqslides[5]=["images/longbit_programme.jpg"]
- seqslides[6]=["images/more5.jpg"]
- seqslides[7]=["images/longbit_gens.jpg"]
The thing is I want to be able to change my variable special depending on the page, and think I should be able to do this by putting the parameter in the HTML but haven't manage to work out how.
This doesn't work
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript" src="diapo.js">special=images/newimage</script>