Hi, I posted this in another string but it seems to fit here to.
You can use code generated in other editors including forms, PHP, Java script, etc. if you first go to your Moodle configuration/editor settings and change the htmleditor to "do not allow". Thus, when you edit a page, only the html script editor will open. You can also open the html editor then toggle to the script editor <> and paste your script in but if you open the html editor again, it will mess up your code.
Your imported script should now work. However if you turn the HTML editor back on and then attempt to edit this page, the Moodle HTML editor will attempt to rewrite your script and it will will chew it all up. I keep a backup copy of the script I enter into Moodle in a Word Pad file so I can fix it if I forget and mess up the script by entering the editor.
I think you will want to leave the htmleditor on for general use but you can turn it off to build special pages.
Let me know if this works for you.
Paste only the script inside the body (do not use the body tags) into the Moodle script editor then save the page. Moodle genterates the header and body tags, etc. automatically.