Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

JavaScript sucks...

Name: Anonymous 2006-06-23 3:18

No, really! I tried to program a bit with it, but it does really strange things and I don't think that this is my fault!

menu = new Array();

function menuobject (one, two)
{
  this.id = one;
  this.stuff = two;
}

menu_db = "1|foo;2|bar;"

for (i=0; i < menu_db.length; i++)
{
  temp = menu_db.split(";");
  menu[i] = new menuobject(temp[0], temp[1]);
}

Name: Anonymous 2006-06-24 22:27

menu_db = menu_db.split(";");
for (i=0; i < menu_db.length; i++)
{
  temp = menu_db.split("|");
  menu[i] = new menuobject(temp[0], temp[1]);
}
look at 'temp = menu_db.split("|");'. do you want this to do the same exact thing on every iteration of the loop? because it doesn't seem to include 'i' anywhere in the expression :)

you probably mean temp = menu_db[i].split("|")

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List