Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

MauroArruda

javascrip le txt e altera checkbox

Recommended Posts

Olá Amigos do iMaster, criei um java muito simples onde ao abrir um formulário o script le os números gravados em um txt e coloca com checado (desabilita o checkbox) mas isso foi a muito tempo e parou de funcionar, já testei em diversos servidores e tenho o mesmo erro.

 

alguem pode me ajudar? segue o form com o código.

<html>

 

<%
'Ao iniciar a página, leio o txt e guardo no campo "txtRifasGuardadas".
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
caminho = Server.Mappath("rifa.txt")
Set TXT = FSO.OpenTextFile(caminho)
On Error resume next
rifas = TXT.readALL
response.write txt.readALL
TXT.close
%>

 

<script language="javascript">
function AlteraExibicao()
{
var tags = document.all.tags("INPUT");
var nrifas = document.form1.txtRifasNoTxt.value;
//Se o campo "txtRifasNoTxt" não estiver vazio, continua.
if(nrifas.length > 0)
{
//Varro as tags dessa página.
for(var i=0; i < tags.length; i++)
{
//Só me interessa os checkbox
if(tags.type == "checkbox")
{
//Se o nome do checkbox estiver no campo que guardou o txt, bloqueio.
if(nrifas.indexOf(tags.name) > -1)
{
tags.checked = true;
tags.disabled = true;
}
}
}
}
}
function GuardaRifas(numero)
{
//Se já existir, retira.
if(document.form1.txtRifasNoTxt.value.indexOf(numero.value) > -1)
{
txt1 = document.form1.txtRifasNoTxt.value;
txt3 = txt1.replace(numero.value, "");
}
else
{
//Guardo no campo "txtRifasNoTxt".
if(document.form1.txtRifasNoTxt.value == "")
txt1 = document.form1.txtRifasNoTxt.value;
else
txt1 = document.form1.txtRifasNoTxt.value+";";
txt2 = numero.value;
txt3 = txt1 + txt2;
}
document.form1.txtRifasNoTxt.value = txt3;
}
</script>
<body>
<form action="rifa_confirma.asp" method="post" enctype="" name="form1" id="form1" onSubmit="" >
<input type="hidden" name="sort" value="alphabetic" />
<table width="90%">
<tr>
<td><table width="98%" bordercolor="#FF9933" border="1" id="numeros2" >
<tr>
<td width="133" height="50" bgcolor="#FFFFFF">
<input name="00" type="checkbox" id="00" onClick="GuardaRifas(this);" value="00"/>
00</td>
<td width="146" height="50" bgcolor="#FFFFFF">
<input name="01" type="checkbox" id="01" onClick="GuardaRifas(this);" value="01"/>
01</td>
<td width="140" height="50">
<input name="02" type="checkbox" id="02" onClick="GuardaRifas(this);" value="02"/>
02</td>
<td width="147" height="50">
<input name="03" type="checkbox" id="03" onClick="GuardaRifas(this);" value="03"/>
03</td>
<td width="168" height="50" bgcolor="#FFFFFF">
<input name="04" type="checkbox" id="04" onClick="GuardaRifas(this);" value="04"/>
04</td>
</tr>
<tr>
<td height="52" bgcolor="#FFFFFF">
<input name="05" type="checkbox" id="05" onClick="GuardaRifas(this);" value="05"/>
05</td>
<td height="52" bgcolor="#FFFFFF">
<input name="06" type="checkbox" id="06" onClick="GuardaRifas(this);" value="06"/>
06</td>
<td height="52" bgcolor="#FFFFFF">
<input name="07" type="checkbox" id="07" onClick="GuardaRifas(this);" value="07"/>
07</td>
<td height="52" bgcolor="#FFFFFF">
<input name="08" type="checkbox" id="08" onClick="GuardaRifas(this);" value="08"/>
08</td>
<td height="52" bgcolor="#FFFFFF">
<input name="09" type="checkbox" id="09" onClick="GuardaRifas(this);" value="09"/>
09</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="10" type="checkbox" id="10" onClick="GuardaRifas(this);" value="10"/>
10</td>
<td height="50" bgcolor="#FFFFFF">
<input name="11" type="checkbox" id="11" onClick="GuardaRifas(this);" value="11"/>
11</td>
<td height="50" bgcolor="#FFFFFF">
<input name="12" type="checkbox" id="12" onClick="GuardaRifas(this);" value="12"/>
12
</td>
<td height="50" bgcolor="#FFFFFF">
<input name="13" type="checkbox" id="13" onClick="GuardaRifas(this);" value="13"/>
13</td>
<td height="50" bgcolor="#FFFFFF">
<input name="14" type="checkbox" id="14" onClick="GuardaRifas(this);" value="14"/>
14</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="15" type="checkbox" id="15" onClick="GuardaRifas(this);" value="15"/>
15
</td>
<td height="50" bgcolor="#FFFFFF">
<input name="16" type="checkbox" id="16" onClick="GuardaRifas(this);" value="16"/>
16</td>
<td height="50" bgcolor="#FFFFFF">
<input name="17" type="checkbox" id="17" onClick="GuardaRifas(this);" value="17"/>
17</td>
<td height="50" bgcolor="#FFFFFF" class="forTexts">
<input name="18" type="checkbox" id="18" onClick="GuardaRifas(this);" value="18"/>
18</td>
<td height="50" bgcolor="#FFFFFF">
<input name="19" type="checkbox" id="19" onClick="GuardaRifas(this);" value="19"/>
19</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="20" type="checkbox" id="20" onClick="GuardaRifas(this);" value="20"/>
20
</td>
<td height="50" bgcolor="#FFFFFF">
<input name="21" type="checkbox" id="21" onClick="GuardaRifas(this);" value="21"/>
21 </td>
<td height="50" bgcolor="#FFFFFF">
<input name="22" type="checkbox" id="22" onClick="GuardaRifas(this);" value="22"/>
22</td>
<td height="50" bgcolor="#FFFFFF">
<input name="23" type="checkbox" id="23" onClick="GuardaRifas(this);" value="23"/>
23</td>
<td height="50" bgcolor="#FFFFFF">
<input name="24" type="checkbox" id="24" onClick="GuardaRifas(this);" value="24"/>
24</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="25" type="checkbox" id="25" onClick="GuardaRifas(this);" value="25"/>
25</td>
<td height="50" bgcolor="#FFFFFF">
<input name="26" type="checkbox" id="26" onClick="GuardaRifas(this);" value="26"/>
26</td>
<td height="50" bgcolor="#FFFFFF">
<input name="27" type="checkbox" id="27" onClick="GuardaRifas(this);" value="27"/>
27</td>
<td height="50" bgcolor="#FFFFFF">
<input name="28" type="checkbox" id="28" onClick="GuardaRifas(this);" value="28"/>
28</td>
<td height="50" bgcolor="#FFFFFF">
<input name="29" type="checkbox" id="29" onClick="GuardaRifas(this);" value="29"/>
29</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="30" type="checkbox" id="30" onClick="GuardaRifas(this);" value="30"/>
30</td>
<td height="50" bgcolor="#FFFFFF">
<input name="31" type="checkbox" id="31" onClick="GuardaRifas(this);" value="31"/>
31</td>
<td height="50" bgcolor="#FFFFFF">
<input name="32" type="checkbox" id="32" onClick="GuardaRifas(this);" value="32"/>
32</td>
<td height="50" bgcolor="#FFFFFF">
<input name="33" type="checkbox" id="33" onClick="GuardaRifas(this);" value="33"/>
33</td>
<td height="50" bgcolor="#FFFFFF">
<input name="34" type="checkbox" id="34" onClick="GuardaRifas(this);" value="34"/>
34</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="35" type="checkbox" id="35" onClick="GuardaRifas(this);" value="35"/>
35</td>
<td height="50" bgcolor="#FFFFFF">
<input name="36" type="checkbox" id="36" onClick="GuardaRifas(this);" value="36"/>
36</td>
<td height="50" bgcolor="#FFFFFF">
<input name="37" type="checkbox" id="37" onClick="GuardaRifas(this);" value="37"/>
37</td>
<td height="50" bgcolor="#FFFFFF">
<input name="38" type="checkbox" id="38" onClick="GuardaRifas(this);" value="38"/>
38</td>
<td height="50" bgcolor="#FFFFFF">
<input name="39" type="checkbox" id="39" onClick="GuardaRifas(this);" value="39"/>
39</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="40" type="checkbox" id="40" onClick="GuardaRifas(this);" value="40"/>
40</td>
<td height="50" bgcolor="#FFFFFF">
<input name="41" type="checkbox" id="41" onClick="GuardaRifas(this);" value="41"/>
41</td>
<td height="50" bgcolor="#FFFFFF">
<input name="42" type="checkbox" id="42" onClick="GuardaRifas(this);" value="42"/>
42</td>
<td height="50" bgcolor="#FFFFFF">
<input name="43" type="checkbox" id="43" onClick="GuardaRifas(this);" value="43"/>
43</td>
<td height="50" bgcolor="#FFFFFF">
<input name="44" type="checkbox" id="44" onClick="GuardaRifas(this);" value="44"/>
44</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="45" type="checkbox" id="45" onClick="GuardaRifas(this);" value="45"/>
45</td>
<td height="50" bgcolor="#FFFFFF">
<input name="46" type="checkbox" id="46" onClick="GuardaRifas(this);" value="46"/>
46</td>
<td height="50" bgcolor="#FFFFFF">
<input name="47" type="checkbox" id="47" onClick="GuardaRifas(this);" value="47"/>
47</td>
<td height="50" bgcolor="#FFFFFF">
<input name="48" type="checkbox" id="48" onClick="GuardaRifas(this);" value="48"/>
48</td>
<td height="50" bgcolor="#FFFFFF">
<input name="49" type="checkbox" id="49" onClick="GuardaRifas(this);" value="49"/>
49</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="50" type="checkbox" id="50" onClick="GuardaRifas(this);" value="50"/>
50</td>
<td height="50" bgcolor="#FFFFFF">
<input name="51" type="checkbox" id="51" onClick="GuardaRifas(this);" value="51"/>
51</td>
<td height="50" bgcolor="#FFFFFF">
<input name="52" type="checkbox" id="52" onClick="GuardaRifas(this);" value="52"/>
52</td>
<td height="50" bgcolor="#FFFFFF">
<input name="53" type="checkbox" id="53" onClick="GuardaRifas(this);" value="53"/>
53</td>
<td height="50" bgcolor="#FFFFFF">
<input name="54" type="checkbox" id="54" onClick="GuardaRifas(this);" value="54"/>
54</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="55" type="checkbox" id="55" onClick="GuardaRifas(this);" value="55"/>
55</td>
<td height="50" bgcolor="#FFFFFF">
<input name="56" type="checkbox" id="56" onClick="GuardaRifas(this);" value="56"/>
56</td>
<td height="50" bgcolor="#FFFFFF">
<input name="57" type="checkbox" id="57" onClick="GuardaRifas(this);" value="57"/>
57</td>
<td height="50" bgcolor="#FFFFFF">
<input name="58" type="checkbox" id="58" onClick="GuardaRifas(this);" value="58"/>
58</td>
<td height="50" bgcolor="#FFFFFF">
<input name="59" type="checkbox" id="59" onClick="GuardaRifas(this);" value="59"/>
59</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="60" type="checkbox" id="60" onClick="GuardaRifas(this);" value="60"/>
60
</td>
<td height="50" bgcolor="#FFFFFF">
<input name="61" type="checkbox" id="61" onClick="GuardaRifas(this);" value="61"/>
61</td>
<td height="50" bgcolor="#FFFFFF">
<input name="62" type="checkbox" id="62" onClick="GuardaRifas(this);" value="62"/>
62</td>
<td height="50" bgcolor="#FFFFFF">
<input name="63" type="checkbox" id="63" onClick="GuardaRifas(this);" value="63"/>
63</td>
<td height="50" bgcolor="#FFFFFF">
<input name="64" type="checkbox" id="64" onClick="GuardaRifas(this);" value="64"/>
64</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="65" type="checkbox" id="65" onClick="GuardaRifas(this);" value="65"/>
65</td>
<td height="50" bgcolor="#FFFFFF">
<input name="66" type="checkbox" id="66" onClick="GuardaRifas(this);" value="66"/>
66</td>
<td height="50" bgcolor="#FFFFFF">
<input name="67" type="checkbox" id="67" onClick="GuardaRifas(this);" value="67"/>
67</td>
<td height="50" bgcolor="#FFFFFF">
<input name="68" type="checkbox" id="68" onClick="GuardaRifas(this);" value="68"/>
68</td>
<td height="50" bgcolor="#FFFFFF">
<input name="69" type="checkbox" id="69" onClick="GuardaRifas(this);" value="69"/>
69</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="70" type="checkbox" id="70" onClick="GuardaRifas(this);" value="70"/>
70</td>
<td height="50" bgcolor="#FFFFFF">
<input name="71" type="checkbox" id="71" onClick="GuardaRifas(this);" value="71"/>
71</td>
<td height="50" bgcolor="#FFFFFF">
<input name="72" type="checkbox" id="72" onClick="GuardaRifas(this);" value="72"/>
72</td>
<td height="50" bgcolor="#FFFFFF">
<input name="73" type="checkbox" id="73" onClick="GuardaRifas(this);" value="73"/>
73</td>
<td height="50" bgcolor="#FFFFFF">
<input name="74" type="checkbox" id="74" onClick="GuardaRifas(this);" value="74"/>
74</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="75" type="checkbox" id="75" onClick="GuardaRifas(this);" value="75"/>
75</td>
<td height="50" bgcolor="#FFFFFF">
<input name="76" type="checkbox" id="76" onClick="GuardaRifas(this);" value="76"/>
76</td>
<td height="50" bgcolor="#FFFFFF">
<input name="77" type="checkbox" id="77" onClick="GuardaRifas(this);" value="77"/>
77</td>
<td height="50" bgcolor="#FFFFFF">
<input name="78" type="checkbox" id="78" onClick="GuardaRifas(this);" value="78"/>
78</td>
<td height="50" bgcolor="#FFFFFF">
<input name="79" type="checkbox" id="79" onClick="GuardaRifas(this);" value="79"/>
79
</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="80" type="checkbox" id="80" onClick="GuardaRifas(this);" value="80"/>
80</td>
<td height="50" bgcolor="#FFFFFF">
<input name="81" type="checkbox" id="81" onClick="GuardaRifas(this);" value="81"/>
81</td>
<td height="50" bgcolor="#FFFFFF">
<input name="82" type="checkbox" id="82" onClick="GuardaRifas(this);" value="82"/>
82</td>
<td height="50" bgcolor="#FFFFFF">
<input name="83" type="checkbox" id="83" onClick="GuardaRifas(this);" value="83"/>
83</td>
<td height="50" bgcolor="#FFFFFF">
<input name="84" type="checkbox" id="84" onClick="GuardaRifas(this);" value="84"/>
84</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="85" type="checkbox" id="85" onClick="GuardaRifas(this);" value="85"/>
85</td>
<td height="50" bgcolor="#FFFFFF">
<input name="86" type="checkbox" id="86" onClick="GuardaRifas(this);" value="86"/>
86</td>
<td height="50" bgcolor="#FFFFFF">
<input name="87" type="checkbox" id="87" onClick="GuardaRifas(this);" value="87"/>
87</td>
<td height="50" bgcolor="#FFFFFF">
<input name="88" type="checkbox" id="88" onClick="GuardaRifas(this);" value="88"/>
88</td>
<td height="50" bgcolor="#FFFFFF">
<input name="89" type="checkbox" id="89" onClick="GuardaRifas(this);" value="89"/>
89</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="90" type="checkbox" id="90" onClick="GuardaRifas(this);" value="90"/>
90</td>
<td height="50" bgcolor="#FFFFFF">
<input name="91" type="checkbox" id="91" onClick="GuardaRifas(this);" value="91"/>
91</td>
<td height="50" bgcolor="#FFFFFF">
<input name="92" type="checkbox" id="92" onClick="GuardaRifas(this);" value="92"/>
92</td>
<td height="50" bgcolor="#FFFFFF">
<input name="93" type="checkbox" id="93" onClick="GuardaRifas(this);" value="93"/>
93
</td>
<td height="50" bgcolor="#FFFFFF">
<input name="94" type="checkbox" id="94" onClick="GuardaRifas(this);" value="94"/>
94
</td>
</tr>
<tr>
<td height="50" bgcolor="#FFFFFF">
<input name="95" type="checkbox" id="95" onClick="GuardaRifas(this);" value="95"/>
95</td>
<td height="50" bgcolor="#FFFFFF">
<input name="96" type="checkbox" id="96" onClick="GuardaRifas(this);" value="96"/>
96</td>
<td height="50" bgcolor="#FFFFFF">
<input name="97" type="checkbox" id="97" onClick="GuardaRifas(this);" value="97"/>
97</td>
<td height="50" bgcolor="#FFFFFF">
<input name="98" type="checkbox" id="98" onClick="GuardaRifas(this);" value="98"/>
98</td>
<td height="50" bgcolor="#FFFFFF">
<input name="99" type="checkbox" id="99" onClick="GuardaRifas(this);" value="99"/>
99</td>
</tr>
<tr>
<td height="50" colspan="5" bgcolor="#FFFFFF">
<input type="hidden" name="txtRifasNoTxt" value="<%=rifas%>" >
<input name="btnEnviar" type="submit" id="btnEnviar" value="finalizar"></td>
</tr>
</table></td>
</tr>
</table>
</form>
<script>AlteraExibicao()</script>
</body>
</html>
antes ele lia o arquivo rifa.txt

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.