Jump to content

[SOLVED] need help here bit of a noob!


EchoFool

Recommended Posts

I have a menu of images i want a user to select then submit that option to update their avatar... currently its not working fulll stop and im getting a strange error... this is the jist of whats going on:

 

 

var state1 = '#000000'; 
var state2 = '#FF0000'; 

function avatar(ava) {
var i = 1;
for( i < 17 ) { 
var thiscell = document.getElementById('avatar'+i); 
if(ava == i) { createplyr.av.value = i; thiscell.style.backgroundColor = state2; 
}else{ 
thiscell.style.backgroundColor = state1 ;
	}
i++
}
} 

 

My current error is this:

 

syntax error

[break on this error] for( i < 17; ) { \n

  This is from firebug in FF, but i can't see my syntax mistake ? What have i done?
Link to comment
https://forums.phpfreaks.com/topic/171057-solved-need-help-here-bit-of-a-noob/
Share on other sites

missing ) after condition

[break on this error] while( i < 17; ) { \n

 

Different error this time... this is the latest script:

 

function avatar(ava) {
var i = 1;
while( i < 17; ) { 
var thiscell = document.getElementById('avatar'+i); 
if(ava == i) { createplyr.av.value = i; thiscell.style.backgroundColor = state2; 
}else{ 
thiscell.style.backgroundColor = state1 ;
	}
i++
}
} 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.