“JavaScript menulis ke file teks” Kode Jawaban

Tulis untuk mengajukan js

// write to js file
const fs = require('fs')

const content = 'this is what i want to write to file'

fs.writeFile('/Users/joe/test.txt', content, err => {
  if (err) {
    console.error(err)
    return
  }
  //file written successfully
})
Chrysler

JavaScript menulis ke file teks

function WriteToFile(passForm) {
 
    set fso = CreateObject("Scripting.FileSystemObject"); 
    set s   = fso.CreateTextFile("<your Path>/filename.txt", True);
 
    var firstName = document.getElementById('FirstName');
    var lastName  = document.getElementById('lastName');
 
    s.writeline("First Name :" + FirstName);
    s.writeline("Last Name :" + lastName);
 
    s.writeline("-----------------------------");
    s.Close();
 }

// HTML
<form onSubmit="WriteToFile(this)">
<label>Type your first name:</label>
<input type="text" name="FirstName" id="firstName" size="20">
 
<label>Type your last name: </abel>
<input type="text" name="LastName" id="lastName" size="20">
 
<input type="submit" value="submit">
</form>
2 Programmers 1 Bug

JavaScript menulis ke file teks

21
6
9
9
8
8
9
9
9
9
9
Defeated Dog

Jawaban yang mirip dengan “JavaScript menulis ke file teks”

Pertanyaan yang mirip dengan “JavaScript menulis ke file teks”

Lebih banyak jawaban terkait untuk “JavaScript menulis ke file teks” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya