Favourites
Most popular topics | Computers Hardware&Softwareopen/close
- Who uses firefox?... (90)
- Programming Languages? Do... (82)
- 1Mb to 2Mb... (77)
- Web Browser poll... (68)
- argh, bloody cookies!!!... (65)
- Computer Games...... (63)
- bit torrents?... (61)
- test your connection spee... (60)
- What games do you play?... (58)
- Internet Explorer 7?... (44)
- Router woes... (42)
- Screen Resolution Poll... (42)
- limewire n windows media ... (40)
- What security do you have... (39)
- noisy fan... (39)
- PC wont boot up... (36)
- Hellllppppppppppppppppppp... (35)
- Next Upgrade... (34)
- Windows Vista... (32)
- Need advice on upgrading ... (31)
- what sad idiot invents vi... (31)
- Webdesigner wanted!... (30)
- Don't get a wireless keyb... (29)
- Firefox 3... (28)
- MSN Error code 80072745?... (26)
Latest topics | Computers Hardware&Softwareopen/close
- Google Chrome...
- Msn keeps crashing..help!...
- easy answers......
- Free antivirus...
- PS3 IDs...
- Dell Printer 928...
- my first Post Fron the iP...
- Windows XP/Zone Alarm and...
- Epson Printers...
- Don't get a wireless keyb...
- _SwapShop_...
- IE6 versus IE7...
- Finally, a www that makes...
- Windows Office...
- hay whats your next compu...
- Lego Indiana Jones...
- CSS issue on IE...
- Homer Simpson - a pure CS...
- Internet access...
- setting up internet acces...
- Free mmo game you play on...
- Niggles with Flirtbox...
- NERVOUS BREAKDOWN!!!...
- Torrent help...anyone???...
- Hi I'm new ... please cou...
Home >> Computers Hardware&Software >> Javascript question
23.02.2007, 12:03 quote
I am not very fond of Javascript as it is not documented properly and it is some sort of pseudo programming language.....
Maybe someone of you has an idea......
I am trying to display the picture description to every user picture inside of a div tag.
If someone clicks through the pictures with the previous and next button, I want to hide all div tags but the one that corresponds to the selected one.
The drop down list displays the number of the images....
This number is also used for naming the div tags.
But how do you reference variable names that are generated dynamically?
The layer is called desc+number = desc0, desc1, desc2....depending on how many user pictures there are.
| Art: |
| function changeImage()
{ var list = document.getElementById('optionlist'); document.mainimage.src = list.options[list.selectedIndex].value; // var anzahl = list.options.length; // for (var x = 1; x < anzahl; x++){ // if (x==list.options[list.selectedIndex]){ // window["desc" + x].style.display='inline'; // } // else { // window["desc" + x].style.display='none'; // } // } // desc.style.display = 'none'; } |
I am not sure whether you use the window method for that or not....
23.02.2007, 13:38 quote
i know nothing about this, but i think you are AMAZINGLY smart for all what you done
_________________
23.02.2007, 13:47 quote
| god wrote: | ||
| I am not very fond of Javascript as it is not documented properly and it is some sort of pseudo programming language.....
Maybe someone of you has an idea...... I am trying to display the picture description to every user picture inside of a div tag. If someone clicks through the pictures with the previous and next button, I want to hide all div tags but the one that corresponds to the selected one. The drop down list displays the number of the images.... This number is also used for naming the div tags. But how do you reference variable names that are generated dynamically? The layer is called desc+number = desc0, desc1, desc2....depending on how many user pictures there are.
I am not sure whether you use the window method for that or not.... |
Which lines exactly are you having trouble with and why, ie, what is your desired output and what is happening, it's difficult to decipher from what you have put, I have hardly done any javacript but I am a competent coder so should be able to help with a bit more detail as it sounds like a fairly generic problem.
_________________
23.02.2007, 17:40 quote
It is maybe a general problem/question.
You have variables that you can use in javascript in order to access the components such as a combobox in order to fire up some events when something happens or in order to find out which selection has been made.
When you click through the pictures on someones profile with the previous and next button, or if you use the combobox to directly jump to a particular picture, a javascript method is called that will replace the image with the selected one.
Now, I want to additionally, not only swap the user picture, but also display some additional text.
In order to do that I print all texts already at the beginning, but I just make them invisible. All those texts are surrounded by <div> tags and have an id - which are called desc0..desc{number of the last picture}.
So all the text is already on the page, but made invisible.
When someone now selects picture 2, the text for picture 2 should be displayed....this means all div elements need to stay invisible and the attribute of the correct div elements needs to be made visible.
If you then select picture 3, all <div> elements apart from desc3 need to be made invisible.
As the number of pictures are dynamic, the javascript needs to dynamically hide and show the div elements.
The name of the div elements can be built inside the javascript method it is just the "desc" string appended with the number of the image.
However, then you only have a string - but I need a reference to the component with that id....so basically it you receive a simple "String" that is the name of the method you want to call.
In real java you would do something like class.forName("com.my.funny.class"), and then you could call a method on it.
I dont know who to do that in Javascript though....it is not even a real class....
29.04.2007, 02:13 quote
What is not referenced ?
http://w3schools.com/jsref/default.asp
http://developer.mozilla.org/en/docs/About_JavaScript
http://jibbering.com/faq/
(ever heard of google?)
29.04.2007, 08:16 quote
| xoid wrote: |
| What is not referenced ?
http://w3schools.com/jsref/default.asp http://developer.mozilla.org/en/docs/About_JavaScript http://jibbering.com/faq/ (ever heard of google?) |
Being sarcastic towards the creator of FlirtBox is a tad silly my friend
_________________
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum






