dimanche 31 janvier 2021

Save input from html to text file problem

So, I've copied this code and tried to run it. It supposed to take the input (in this case, name) and save it into a text file. But, it didn't work as I expected, can someone tell me what's wrong with this code?

<!DOCTPYE html>

<head>
<title>Web test</title>
</head>

<body>
<form onSubmit="WriteToFile(this)">
    <label>Name please: </label>
    <input type="text" name="nname" id="fname" size="18">
    <br>
    <br>
    <input type="submit" value="submit"> 
</form>
<script>
    function WriteToFile(passForm){
    set fso = CreateObject("Scripting.FileSystemObject");
    set s = fso.CeateTextFile("test.txt", True);
    var firstName = document.geteElementById('fname');
    s.writeline(firstName);
    s.writeline("");
    s.Close();
    }
</script>
</body>
```


Aucun commentaire:

Enregistrer un commentaire