|
| 31 Aug 2011 05:37 PM |
I dont know if there are tables, but I want it like in Lua it would be.
OriginalName = { "Sorcus", "ArecusInator", "Tenal", "61352151511", }
NewNames = { "A Troll", "Arecus", "Emess", "Mitch", }
And then blah blah, change the text to NewName. But how would I do this?
~ Mitch |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2011 05:39 PM |
It's called an array.
public string[] table = new string[4]
|
|
|
| Report Abuse |
|
|
|
| 31 Aug 2011 05:40 PM |
| Oops! I thought you were asking Java, not JavaScript... |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2011 05:42 PM |
stupid name similarities
~ Mitch |
|
|
| Report Abuse |
|
|
t6e
|
  |
| Joined: 25 Dec 2010 |
| Total Posts: 587 |
|
|
| 31 Aug 2011 05:43 PM |
var types = new Array("Troll","Lord"); var people = new Array("Dap300","Myrkos"); |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2011 05:45 PM |
| var whyDon'tIEverUseThingsMySchoolTeachesMe = new Array("fruit"); |
|
|
| Report Abuse |
|
|
Tenal
|
  |
| Joined: 15 May 2011 |
| Total Posts: 18684 |
|
| |
|
|
| 31 Aug 2011 05:49 PM |
okay, and a for loop. How would I use the # operator? Is it the same?
for(1, #OldNames)
or something.
~ Mitch |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2011 05:50 PM |
foreach (String str in OldNames) {
}
??? |
|
|
| Report Abuse |
|
|
Tenal
|
  |
| Joined: 15 May 2011 |
| Total Posts: 18684 |
|
| |
|
booing
|
  |
| Joined: 04 May 2009 |
| Total Posts: 6594 |
|
|
| 31 Aug 2011 05:52 PM |
array.length var b = new Array(); b = {"a","b","c"} for (var i in b) { document.write(b[i]) } |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2011 05:54 PM |
ok lets just say
for A = 1, 3 do
What would that be?
for (Item in 3)
That probably fails
~ Mitch |
|
|
| Report Abuse |
|
|
Aaaboy97
|
  |
| Joined: 05 Apr 2009 |
| Total Posts: 6612 |
|
|
| 31 Aug 2011 05:56 PM |
I believe it is:
for (var A = 1; A < 3; A++) { // stuff } |
|
|
| Report Abuse |
|
|
booing
|
  |
| Joined: 04 May 2009 |
| Total Posts: 6594 |
|
|
| 31 Aug 2011 05:56 PM |
for (i=1;i<4;i++) { document.write(i); } 1 2 3 |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2011 05:57 PM |
I have this so far
var OldNames=new Array(); OldNames[1] = "Sorcus"; OldNames[2] = "61352151511"; OldNames[3] = "Tenal"; var NewNames=newArray(); NewNames[1] = "A Troll"; NewNames[2] = "Mitch"; NewNames[3] = "Emess";
function FIX() { var x=document.getElementsByTagName("A"); for (Item in x) { for (var i in OldNames){ if (x[Item].innerText==OldNames[i]) { x[Item].alt = x[Item].innerText; x[Item].innerText = NewNames[i]; } } }
FIX();
The console says Unexpected end of input
On the last line |
|
|
| Report Abuse |
|
|
booing
|
  |
| Joined: 04 May 2009 |
| Total Posts: 6594 |
|
| |
|
|
| 31 Aug 2011 06:04 PM |
Ahh thanks, but I still get the same error
~ Mitch |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2011 06:06 PM |
*facepalm* Forgot to add the new tabbing in and forgot a }
it works now, thanks
~ Mitch |
|
|
| Report Abuse |
|
|