Hi,
I desperately need some help with what I assume to be a minor problem
that I just can't solve.
I'm writing a page where on mouseover a link, an image needs to be
displayed and some text, which is defined inside an array, sould
appear inside a table cell (whose id is "tdDesc").
That's basically what's in the HTML-file:
<body onload="resetDesc('WS_Standard','3');">
<a href="#" onmouseover="showDesc('WS_Standard','1');"
onmouseover="showDesc('WS_Standard','1');">
Link no. 1</a>
Here's what's in the js-File.
01 function showDesc(typeDesc,noDesc) {
02 var imgDesc = ('img' + typeDesc + '_' + noDesc);
03 document.getElementById('tdDesc').innerHTML =
WS_Standard[noDesc];
04 document.getElementById(imgDesc).style.display = "";
05 }
06 function hideDesc(typeDesc,noDesc) {
07 var imgDesc = ('img' + typeDesc + '_' + noDesc);
08 document.getElementById('tdDesc').innerHTML = WS_Standard[0];
09 document.getElementById(imgDesc).style.display = "none";
10 }
11 function resetDesc(typeDesc,totalDesc) {
12 for (var i = 1; i <= totalDesc; i++) {
13 var imgDesc = ('img' + typeDesc + '_' + i);
14 document.getElementById(imgDesc).style.display = "none";
15 }
16 document.getElementById('tdDesc').innerHTML = WS_Standard[0];
17 }
18 var WS_Standard = new Array();
19 WS_Standard[0] = "Standard text when no mouse over";
20 WS_Standard[1] = "Sample Text 1";
21 WS_Standard[2] = "Sample Text 2";
22 WS_Standard[3] = "Sample Text 3";
My problem appears when it comes to adressing the text that is in the
array, lines 03, 08, 16. I want to use my "typeDesc"-argument to
adress the array, but whatever I try, it's either an error or I get a
string "WS_Standard" or "WS_Standard[1]" or something, but never the
text in the array WS_Standard[1].
What am I doing wrong?
Any help is highly appreciated!
Martin