Here is the sample code:
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
function WriteFile()
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fh = fso.CreateTextFile("c:\\Test.bmp", true);
fh.WriteLine("Some text goes here...");
fh.Close();
}
</SCRIPT>
</HEAD>
<BODY>
<P>
<SCRIPT language="JavaScript"> WriteFile(); </SCRIPT>
</P>
</BODY>
</HTML>