get data from html form and write into a file, javascript, get data from html form and write into a file, javascript |
get data from html form and write into a file, javascript, get data from html form and write into a file, javascript |
Daralis |
Apr 25 2012, 05:47 PM
Post
#1
|
Group: Members Posts: 5 Joined: 25-April 12 Member No.: 16,984 |
Im trying to write data retrieved from html form, but can't make it work. Please help me. Iam a newbies to this.
Thanks so so much. <script LANGUAGE="JavaScript"> function Write(input0, input1, input2) { var Scr = new ActiveXObject("Scripting.FileSystemObject"); var CTF = Scr.CreateTextFile("employeefile.txt", 1, true); CTF.WriteLine(input0 + ","+ input1 + ","+ input2); CTF.Close(); } function validateForm() { var x1=document.userform.pwd.value; var x2=document.userform.re_pwd.value; if (x2 == x1) { document.write(document.userform.empname.value) Write(document.userform.empname.value, document.userform.user.value, document.userform.pwd.value); } else { alert("Passwords are not the same, Re-enter password"); } } </SCRIPT> </head> <body> <table width=100% border="0"> <tr> <td style="background-image:url(http://farm8.staticflickr.com/7092/7114162767_1c07772c85.jpg); background-size:cover;"> <p style="font-family:Britannic Bold;font-size:180%;color:#3300FF;text-align:center;"> <br /><br /> REGISTER </p><br /> </td> </tr> <tr> <td style="background-color:#EEEEEE;height:700px;background-size:cover;text-align:center;"> <form ACTION="" NAME="userform" METHOD="GET" ONSUBMIT="return validateForm()">Create employee profile: <BR><br /><br /> Employee Name: <input type="name" name="empname" size="35"/><br /><br /> Username: <input type="logintext" name="user" size="35"/><br /><br /> Password: <input type="password" name="pwd" size="35"/><br /><br /> Re-enter Password: <input type="re_password" name="re_pwd" size="35"/><br /><br /> <input type="submit" value="Submit" size="35"/> </form> </td> </tr> <footer> <tr> <td colspan="2" style="background-color:#FFA500; width:100%; height=50px; text-align:center;"> Copyright © 2012 QGS Inc. </td> </tr> </table> </footer> </body> </html> This post has been edited by Daralis: Apr 25 2012, 06:27 PM |
Brian Chandler |
Apr 26 2012, 04:33 AM
Post
#2
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
Are you really trying to write this to a file on the visitor's computer?
(As I understand it, normally javascript has no access to the local file system, for obvious reasons. Perhaps this "activeX" stuff is part of the MS virus dissemination kit, but if so it won't work in many cases.) |
Lo-Fi Version | Time is now: 26th April 2024 - 02:35 PM |