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
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++
}
} 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.