我试图从一个html表单写入一个文件,但是javascript的写入部分没有做任何事情.
只有脚本的验证部分似乎正在工作.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script LANGUAGE="JavaScript">
function Write(input1, input2)
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile("C:\\test.txt", true);
s.WriteLine(input1 + "," + input2);
s.Close();
}
function validateForm() {
var x1=document.userform.pwd.value;
var x2=document.userform.re_pwd.value;
if (x2 == x1){
Write(document.userform.user.value, document.userform.pwd.value);
}
else{alert("Passwords are not the same, Re-enter password");}
}
</SCRIPT>
<head>
<link rel="stylesheet" href="css/screen.css" media="screen" />
</head>
<body>
<div id="container">
<h2>Create a new account <?php echo "It works!"; ?></h2>
<form id="form1" NAME="userform" …Run Code Online (Sandbox Code Playgroud)