Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with array

Status
Not open for further replies.

TurboSRT4

Programmer
Nov 23, 2009
47
US
can someone please help im going crazy! lol

please see this
if you click a season the episode list apears on the right.
if you click an episode it adds the id to an array and you will notice the array appear on the left with each value in it.

if you click the value of the array on the left you will notice the episodes in the array highlight purple in the list on the right. for somereason if i scroll over another season then click the array again to highlight purple, it does not work. it is almost like the array is disapearing but it is not because its value is still displayed. please help me thank you. here is some of the code but please view my source thank you

function rightClick(episode,pass){
trueEpisode = episode;
evalEpisode = eval(episode);
truePass = pass;
evalPass = eval(pass);

stayGreen.push(trueEpisode);
evalGreen.push(evalEpisode);
document.getElementById('testing').innerHTML = evalGreen;
}

function test(){
for (i=0;i<evalGreen.length;i++){
evalGreen.style.backgroundColor = 'purple';
}
document.getElementById('testing').innerHTML = evalGreen;

}
 
i just changed the code to help it now displays the evaluated value of the array and the literal value. thanks guys

function rightClick(episode,pass){
trueEpisode = episode;
evalEpisode = eval(episode);
truePass = pass;
evalPass = eval(pass);

stayGreen.push(trueEpisode);
evalGreen.push(evalEpisode);
document.getElementById('testing').innerHTML = evalGreen+'<br>'+stayGreen;
}

function test(){
for (i=0;i<evalGreen.length;i++){
evalGreen.style.backgroundColor = 'purple';
}
document.getElementById('testing').innerHTML = evalGreen+'<br>'+stayGreen;

}
 
Hi

TurboSRT4 said:
if you click an episode it adds the id to an array and you will notice the array appear on the left with each value in it.
Here nothing happens on the left...

Until I get your goal, two advices :
[ul]
[li]use [tt]eval()[/tt] only when absolutely needed[/li]
[li]do not specify [tt]javascript:[/tt] pseudo-protocol in event attributes' values[/li]
[/ul]


Feherke.
 
sweet i got it i do not understand why it is but it is! thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top