please check the below code, in div tag i have one text i want to change this text with new text when i click write button.. plz save this file as test.htm

function WriteToFile()
var s=document.getElementById('txt');
var oldtxt=s.firstChild.nodeValue;
var newtxt="hi this is naveen";
var fso = new ActiveXObject("Scripting.FileSystemObject");
var FileObject = fso.OpenTextFile("D:\\testing\\test.htm", 8, true,0); // 8=append, true=create if not exist, 0 = ASCII
<a href="javascript:WriteToFile();">write</a>
<div id="txt">welcome man </div>