dimanche 1 août 2021

write to file in aspx page with javascript

I want to write a text in to a file when my div clicked. (in an aspx page).

So I wrote an javascript function to call it when my div clicked.

<div onclick="myFunction()" class="aclassbutton" role="button" tabIndex="0" >

my function is something like that:

<script type="text/javascript">
function myFunction() {
    var fs = require("fs");
    fs.writeFile('c:\\users\\admin\\documents\\input.txt', 'Simply Easy Learning!', function(err) {
       if (err) {
          return ;
       }
    });
}
</script>

I test the function with NODE and it worked fine. But it doesn't work in my page! what's wrong with it?! Is there any other way to do that?




Aucun commentaire:

Enregistrer un commentaire