Wondering if anyone can help with some javascript that randomly selects a kanji from between 2-5 choices and remembers the index for the back side.
I'm making a deck of lookalike kanji from this list courtesy of lauri ranta. I have 10 fields: Kanji1, Keyword1, Kanji2....and so on up to Keyword5. I would like to create a javascript that randomly chooses a kanji from the available choices (varies from 2-5 kanji because some are blank). I'll also show all of the keywords for that group to make kind of a multiple choice card but I don't need javascript for that part. Then, on the answer side it will show the same info, but with the correct keyword highlighted.
I was looking at this page and trying to adapt the code, but then I noticed it doesn't even do what it claims to do unmodified on my computer. I did notice a slight error in the 3rd line where } is missing so there may be other errors preventing the javascript from working correctly, or it may be that I'm on a mac, or something else. I'm also not sure if javascript works on ankimobile which is where I intend to study this deck.
Can anyone point me in the right direction? I've only used javascript to automate things within another program, but never in combination with css or webpages like most people. If I can get something suitable, I'll post the results so that others can use it too.
I'm making a deck of lookalike kanji from this list courtesy of lauri ranta. I have 10 fields: Kanji1, Keyword1, Kanji2....and so on up to Keyword5. I would like to create a javascript that randomly chooses a kanji from the available choices (varies from 2-5 kanji because some are blank). I'll also show all of the keywords for that group to make kind of a multiple choice card but I don't need javascript for that part. Then, on the answer side it will show the same info, but with the correct keyword highlighted.
I was looking at this page and trying to adapt the code, but then I noticed it doesn't even do what it claims to do unmodified on my computer. I did notice a slight error in the 3rd line where } is missing so there may be other errors preventing the javascript from working correctly, or it may be that I'm on a mac, or something else. I'm also not sure if javascript works on ankimobile which is where I intend to study this deck.
Can anyone point me in the right direction? I've only used javascript to automate things within another program, but never in combination with css or webpages like most people. If I can get something suitable, I'll post the results so that others can use it too.
Edited: 2016-01-22, 5:59 am by fuaburisu

![[Image: QZ5OUcb.png]](http://i.imgur.com/QZ5OUcb.png)
![[Image: 04PdBSZ.png]](http://i.imgur.com/04PdBSZ.png)