.NET to Javascript compiler

C# code   Html page   Start
public class TextInputElementSelectionApp : HtmlGlobal
{
	HtmlElement screen;

    public static void Start()
	{
		new TextInputElementSelectionApp();
	}
	
	TextInputElementSelectionApp()
	{
		screen = document.GetElementById("screen");
		((HtmlInputText)document.GetElementById("text")).AdviseSelectionChange(OnSelectionChange);
	}

    void OnSelectionChange(HtmlEditableElement sender, HtmlSelection selection)
	{
		if (selection == null)
		{
			screen.InnerText = "no selection";
		}
		else
		{
			screen.InnerText = "Start: " + selection.Start + "\r\nEnd:" + selection.End;
		}
	}
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
    <meta content="x-ua-compatible" http-equiv="IE=11;IE=10;IE=9;IE=8;IE=7" />
    <script language="javascript" type="text/javascript" src="js/TextInputElementSelection.js"></script>
	</head>
	<body onload="javascript:StartScript()">
		TextInputElementSelection.html: selection handling. Please enter text end select/deselect text part
		<input type="text" style="width:200px" id="text"/>
		<div id="screen">
		</div>
	</body>
</html>

© 2009 JScriptSuite. All rights reserved.