Javascript: need help with code!
I'm writing code for a gallery in which every time you mouseover a picture the text of a caption changes with the name of the place shown in the image. My first idea for this was to use the value of the Id (which is a number, for that purpose) of the container of the image to act as a value within an array, where the corresponding caption is stored. I don't know if this is possible, i've been trying it but mainly i'm not sure how to capture the id of an object in a variable without having to reference it in the code itself. Maybe i'm thinking this in the wrong way. All suggestions and directions are appreciated. i have no more code written than this, which at the moment doesn't work. var castle ["Castillo de Cahir- Condado de Tipperary- 1142", ""Castillo de Cahir- Condado de Tipperary- 1142"", ""Castillo de Cahir- Condado de Tipperary- 1142"", "Castillo de Ormonde - Condado de Tipperary - 1600", "Castillo de Ashford - Condado de Mayo - 1400", "Castillo de Ashford - Condado de Mayo - 1400", "Castillo de Dublín - Ciudad de Dublín - 1700", "Castillo de Dublín - Ciudad de Dublín - 1700", "Castillo de Doonagore - Condado de Claire -1500", "Castillo de Doonagore - Condado de Claire -1500", "Castillo Manderley - Ciudad de Dublin -1840" ] /*this function gets triggered from an mouseover event in a container div for the image*/ function idrecolector(){ var nro= this.id.value infotext() } /*and this function is supposed to replace the text of the caption with the text stored in the array corresponding to the id number of the object*/ function infotext() { documentGetById("subtexto").innerhtml = castle[nro] } Many thanks in advance