There is nothing i can do if you do not disclose your full javascript code. Plus i never personally try if the motd actually run it at all. If you find example somewhere that mean the motd may support it. Try they tutorial first, chances are the code just grab, plug and play.
Also do not open multiple thread if you can just compose your question in a single thread. Give it a long thought then throw the questions in one go.
On a side note, this most likely going off topic too. So.. try to do a research first then ask moderator to move your thread to the appropriate place
Edit: you know what.. i lied.. i m lazy testing that. So please help yourself first then pursuit your question.
__________________