Cara sabe aquela função ....
Cara sabe aquela função que quando você digita seu telefone aparece o espaço entre os numeros ou então quando você digita seu cpf aparece os pontos pois então fiz uma e tava funfando legal mais ai fui colocar dentro de outras tabelas e parou de funcio nar ele sozinho vai mais dentro de um conteudo não funciona .
ta ai o codigo peço uma ajuda dos ammigos pra resolver esse pro ainda mais que eu não sou programado so curioso
dede ja obrigado.
<script language="JavaScript">
function txtBoxFormat(objForm, strField, sMask, evtKeyPress) {
var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
if(document.all) { // Internet Explorer
nTecla = evtKeyPress.keyCode; }
else if(document.layers) { // Nestcape
nTecla = evtKeyPress.which;
}
sValue = objForm[strField].value;
// Limpa todos os caracteres de formatação que
// já estiverem no campo.
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( " ", "" );
sValue = sValue.toString().replace( " ", "" );
fldLen = sValue.length;
mskLen = sMask.length;
i = 0;
nCount = 0;
sCod = "";
mskLen = fldLen;
while (i <= mskLen) {
bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))
if (bolMask) {
sCod += sMask.charAt(i);
mskLen++; }
else {
sCod += sValue.charAt(nCount);
nCount++;
}
i++;
}
objForm[strField].value = sCod;
if (nTecla != 8) { // backspace
if (sMask.charAt(i-1) == "9") { // apenas números...
return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9
else { // qualquer caracter...
return true;
} }
else {
return true;
}
}
</script>
<span class="style9">
<form id="form1" name="myForm" method="post" action="">
<table width="450" border="0" cellpadding="0" cellspacing="2">
<tr>
<th colspan="2" scope="col">Fale Conosco </th>
</tr>
<tr>
<td>Nome:</td>
<td><label>
<input name="nome" type="text" id="nome" size="60" />
</label></td>
</tr>
<tr>
<td>E-mail:</td>
<td><label>
<input name="email" type="text" id="email" size="60" />
</label></td>
</tr>
<tr>
<td>Telefone:</td>
<td><table width="356" border="0">
<tr>
<td width="179"><label>fixo:
<input name="str_tel" type="text" size="17" maxlength="14" onkeypress="return txtBoxFormat(document.myForm, 'str_tel', '(99) 9999-9999', event);">
</label></td>
<td width="167">cel:
<label>
<input name="str_cel" type="text" size="17" maxlength="14" onkeypress="return txtBoxFormat(document.myForm, 'str_cel', '(99) 9999-9999', event);">
</label></td>
</tr>
</table> <label></label></td>
</tr>
<tr>
<td>Assunto:</td>
<td><select name="assunto" >
<option>Graduação</option>
<option>Pós-Graduação</option>
<option>Cursos Jurídicos</option>
<option>Cursos Para Concursos</option>
<option>Cursos Técnicos</option>
<option>Cursos Corporativos</option>
<option>Curso de Idiomas</option>
<option>Institucional</option>
<option>Reclamações</option>
<option>Outros</option>
</select></td>
</tr>
<tr>
<td>Texto:</td>
<td>
<label>
<textarea name="texto" cols="50" rows="5" id="texto"></textarea>
</label>
</td>
</tr>
<tr>
<td colspan="2"><label>
<div align="center">
<input type="submit" name="Submit" value="enviar" />
<input type="reset" name="Submit2" value="limpar" />
</div>
</label></td>
</tr>
</table>
</form></span>Discussão (1)
Carregando comentários...