I want to create a file .txt with activex and javascript. I've tried this but it's not working. Maybe I've install something to use activex. I don't know where is my mistake. I've looked for before asking my questions here.
this is html part
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Choix du code CNI</title>
<link rel="stylesheet" href="i2.css">
</head>
<body>
<div style="padding: 50px 0px; text-align: center;">
<div id="myDiv">
<p>Choix du code CNI</p>
</div>
<select name="codeCNI" id="codeCNI" size=1 ">
<option selected="selected"> </option>
<option>VH: Humanis
<option>CI: CreIrcafex
<option>BT: CRR
<option>AG: AG2R
<option>IR: Ircem
<option>CP: Crepa
</select>
<br/><br/>
<input type='button' id='valider_cni_value' name='pseudo' value='Valider Code CNI' onclick="createNewFile()"/>
</div>
<script src="i2.js"></script>
</body>
</html>
this is javascript part
var fso, objet;
fso = new ActiveXObject("Scripting.FileSystemObject");
function createNewFile(){
objet = fso.CreateTextFile("C:/monfichier.txt", true);
fso=null;
}
The problem was the path.
The path is not this : C:/monfichier.txt
It's : ../monfichier.txt