Otto Lang schrieb:
Please do not place your text on top of the quoted text.
max <in**@bkom.chwrote:
I don't get it working. here my layout:
var aa = "einseins"; var ab = "einszwei"; var ac = "einsdrei";
Okay, you have 3 variables. Each is a string.
var a3 = aa + ab + ac ; // this should sum up the 3 vars above
This results in
a3 = "einseinseinszweieinsdrei";
function showEins() {
for (i = 0; i <=0; i++)
This doesn't make any sense. After the first run this loop will stop
because ``i'' is greater than zero after ``i++''.
{
// show1 = [aa, ab, ac]; // with i<=2; this works, but is too long in
other cases
Here you create an array with 3 items: ``einseins'', ``einszwei'' and
``einsdrei''.
show1 = [a3]; // does not work
To read the 3rd item of this array you have to write
show1[2]
Arrays are zero based. With your syntax you create an array ``show1''
with 1 item.
// var a3 = [aa,ab,ac].join(' '); // did not work either. do I have
to fill in the brackets?
This results in
a3 = "einseins einszwei einsdrei"
document.getElementById(show1[i]).style.visibility ="visible";
What do you exactly want to do?
thank you. max.
HTH
./otto
--
/"\ ASCII ribbon | http://www.wean.at
\ / campaign against | http://www.lang-kritz.at
x HTML postings | http://www.diepranger.at
/ \ & email |
thanks for your detailed commentary.
what I need to do is simplifying a dynamic navigation for a website.
the navigation has three hierarchic levels. with each mouse rollover
some field show, others hide. this is defined in js as follows:
----------------------------------
function showEinszwei() {
for (i = 0; i <=7; i++)
{
show1 = ["einseins", "einszwei", "einsdrei",
"einsvier","einszweieins", "einszweizwei", "einszweidrei",
"einszweivier"];
document.getElementById(show1[i]).style.visibility ="visible";
}
for (i = 0; i <=71; i++)
{
hide1 =
["einseinseins","einseinszwei","einseinsdrei","eins dreifuenf",
"einsdreieins", "einsdreizwei", "einsdreidrei", "einsdreivier",
"einsviereins", "einsvierzwei", "einsvierdrei", "einsviervier",
"zweieins", "zweizwei", "zweidrei", "zweivier",
"zweieinseins","zweieinszwei","zweieinsdrei","zwei einsvier","zweizweieins","zweizweizwei",
"zweizweidrei","zweizweivier","zweidreieins","zwei dreizwei","zweidreidrei","zweidreivier",
"zweiviereins","zweivierzwei","zweivierdrei","zwei viervier","dreieins","dreizwei","dreidrei",
"dreivier","dreieinseins","dreieinszwei","dreieins drei","dreieinsvier","dreizweieins","dreizweizwei" ,
"dreizweidrei","dreizweivier","dreidreieins","drei dreizwei","dreidreidrei","dreidreivier","dreiviere ins",
"dreivierzwei","dreivierdrei","dreiviervier","vier eins","vierzwei","vierdrei","viervier","viereinsei ns","viereinszwei",
"viereinsdrei","viereinsvier","vierzweieins","vier zweizwei","vierzweidrei","vierzweivier","vierdreie ins",
"vierdreizwei","vierdreidrei","vierdreivier","vier viereins","viervierzwei","viervierdrei","viervierv ier"];
document.getElementById(hide1[i]).style.visibility ="hidden";
}
}
----------------------------------
as you see, the list under hide1 is far too long. I tried to assign a
variable to each string (var aaa = "einseinseins" ;). thus my hide 1
becomes shorter, but still too long. in a second step I tried to
combine these strings into groups. for instance, all string starting
with "vier..." could be grouped.
thus I hoped, that grouping the three varibles aa, ab and ac (which in
turn represent the strings "einseins", "einszwei" and "einsdrei") into
a new variable called a3. but I failed.
thanks for your help. max.