Nikhil Kothari has released a tool which can help you do this if you plan to use C#.  It's called Script# and it compiles C# to JavaScript (rather than IL).  Here's an article from Nikhil's blog with sample code.