<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Сайт</title>
</head>
<script type="text/javascript">
function showLayer() {
document.getElementById("polefind").style.visibility = "visible";
}
function createfile(form)
{
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var f = FSO.OpenTextFile("c:\\filesave.txt", 8, true);
f.writeline("");
f.Write(form.tube.value + " " + form.number.value + " " + form.date.value + " " + form.family.value + " ");
if (form.defect1.checked == 1) f.write(form.defect1.value + " ");
if (form.defect2.checked == 1) f.write(form.defect2.value + " ");
if (form.defect3.checked == 1) f.write(form.defect3.value + " ");
if (form.defect4.checked == 1) f.write(form.defect4.value + " ");
if (form.defect5.checked == 1) f.write(form.defect5.value + " ");
if (form.defect6.checked == 1) f.write(form.defect6.value + " ");
if (form.defect7.checked == 1) f.write(form.defect7.value + " ");
if (form.defect8.checked == 1) f.write(form.defect8.value + " ");
f.Close();
}
function poisk() {
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var f = FSO.OpenTextFile("c:\\filesave.txt", 1, true);
myArray= new Array();
var i=0;
var reg = new RegExp(window.document.form.find.value);
window.document.polefind.write("<table width='40%' style='border-collapse: collapse; font-size: 90%'>");
while (!f.AtEndOfStream) {
myArray[i] = f.ReadLine();
if(reg.test(myArray[i])==true)
{
window.document.polefind.write("<tr><td>");
window.document.polefind.write(myArray[i]);
window.document.polefind.write("</td></tr>");
}
i=i+1;
}
window.document.polefind.write("</table>");
}
<style type="text/css">
#tube, #number, #date, #family, #butt {
position: absolute;
top:10px;
border: 1px solid #000080;
margin:2px;
}
#tube {
left:2px;
border-right:0px;
}
#number {
left:153px;
border-left:0px;
border-right:0px;
}
#date {
left:303px;
border-left:0px;
border-right:0px;
}
#family {
left:453px;
border-left:0px;
border-right:0px;
}
#butt {
border-left:0px;
left:603px;
}
#tube P, #number P, #date P, #family P, #butt P {
margin:0px;
padding-bottom:3px;
margin-bottom:5px;
text-align:center;
color:white;
font-weight:bold;
border-bottom: 1px solid blue;
background: #000080;
font-family: Arial, Helvetica, sans-serif;
font-size: 80%;
}
input.but {
width: 12%;
}
input.but1 {
width: 5%;
}
#find {
position:absolute;
top:100px;
left:20%;
}
#polefind {
position:absolute;
left:20%;
top:180px;
visibility:hidden;
}
</style>
<body>
<form name="mainform">
<div id="tube">
<p>Газопровод</p>
<input type="text" name="tube">
</div>
<div id="number">
<p>№ Трубы</p>
<input type="text" name="number">
</div>
<div id="date">
<p>Дата обследования</p>
<input type="text" name="date">
</div>
<div id="family">
<p>ФИО</p>
<input type="text" name="family">
</div>
<div id="butt">
<p> </p>
<input type="button" name="button" class="but" value="Добавить данные" onClick="createfile(this.form); poisk();">
</div>
<div id="find">
<table width="40%">
<tr>
<th colspan="2">Поиск по критериям</td>
</tr>
<tr>
<td><input type="text" size="64" name="find"></td>
<td><input type="button" value="Поиск" onClick="showLayer(); "></td>
</tr>
</table>
</form>
<div id="polefind"> </div>
</body>
</html>