It is the following:
I have an index.html page where the user selects a certain amount via input radio.
Clicking on GENERATES a function where document.write creates a form according to the value previously selected by the user. That is, you have selected 2, 2 forms appear, etc. ...
My problem is in the masks of this form. (Date and RG) I mounted the page generated through the function in pure HTML and the masks work quietly.
Basically it is: I have an .js file and I want to call another .js file from it. I've tried unescape, I do not know if I've misused the syntax, because it's discontinued, or it does not work, I do not know ...
I looked in several forums, I found basically the same answer and nothing worked until then. As I'm new to javascript, I must be doing something wrong or letting some detail go by.
I hope you can help me.
Thanks for the responses so far.
The answers so far do not look anything like what I did. T_T
This is the index.html page where the user chooses the quantity.
<body>
<div class="body">
<div class="content_body">
<div class="logo">
<img src="img/logo.png">
</div>
<div class="title">
QUANTAS CREDENCIAS VOCÊ GOSTARIA DE GERAR?
</div>
<div class="options">
<form>
<p><label> 1 </label><br>
<input name="Opc" value="1" type="radio"/></p>
<p><label> 2 </label><br>
<input name="Opc" value="2" type="radio"/></p>
<p><label> 3 </label><br>
<input name="Opc" value="3" type="radio"/></p>
<p><label> 4 </label><br>
<input name="Opc" value="4" type="radio"/></p>
<p><label> 5 </label><br>
<input name="Opc" value="5" type="radio"/></p>
</form>
</div>
<div class="submit">
<input onclick="qtdd()" type="submit" value="GERAR"/>
</div>
</div>
</div>
</body>
Below is the page that is created by clicking "GENERATE".
(I only put HTML, but there is a check of which field is checked)
document.write(
"<html>" +
"<head>" +
"<link rel='stylesheet' type='text' href='css/credencial.css'/>" +
"<meta charset='UTF-8'/>" +
"<link rel='shortcut icon' href='img/logo.ico' type='image/x-icon'>" +
//Linkar javascript aqui
"</head>" +
"<body>" +
"<div class='body'>" +
"<div class='content_body'>" +
"<div class='logo'>" +
"<img src='img/logo.png'>" +
"</div>" +
"<div class='title'>" +
(1+i) + "° CREDENCIAL - FRENTE " +
"</div>" +
"<div class='frente'>" +
"<form>" +
"<p><label> NOME: </label></p>" +
"<input autofocus type='text'>" +
"<p><label> CARGO: </label>" +
"<input type='text'></p>" +
"<p><label> RECEBIDO POR: </label></p>" +
"<input type='text'>" +
"</div>" +
"<div class='title'>" +
(1+i) + "° CREDENCIAL - VERSO " +
"</div>" +
"<div class='verso'>" +
"<p class='form2'><label> RG: </label><br>" +
"<input type='text' id='rg'>   </p>" +
"<p class='form2'><label> ESTADO CIVIL: </label><br>" +
"<select>" +
"<option value=' ' title='Nenhum'> </option>" +
"<option value='Solteiro(a)'> Solteiro(a) </option>" +
"<option value='Casado(a)'> Casado(a) </option>" +
"<option value='Divorciado(a)'> Divorciado </option>" +
"<option value='Viúvo(a)'> Viuvo(a) </option>" +
"</select>" +
"<p class='form2'><label> DATA DE NASCIMENTO: </label><br>" +
"<input id='dtn' type='text'>   </p>" +
"<p class='form2'><label> ESTADO: </label><br>" +
"<select>" +
"<option value=' ' title='Nenhum'> </option>" +
"<option value='Acre' title='Acre'> AC </option>" +
"<option value='Alagoas' title='Alagoas'> AL </option>" +
"<option value='Amapá' title='Amapá'> AP </option>" +
"<option value='Amazonas' title='Amazonas'> AM </option>" +
"<option value='Bahia' title='Bahia'> BA </option>" +
"<option value='Ceará' title='Ceará'> CE </option>" +
"<option value='Distrito Federal' title='Distrito Federal'> DF </option>" +
"<option value='Espírito Santo' title='Espírito Santo'> ES </option>" +
"<option value='Goiás' title='Goiás'> GO </option>" +
"<option value='Maranhão' title='Maranhão'> MA </option>" +
"<option value='Mato Grosso' title='Mato Grosso'> MT </option>" +
"<option value='Mato Grosso do Sul' title='Mato Grosso do Sul'> MS </option>" +
"<option value='Minas Gerais' title='Minas Gerais'> MG </option>" +
"<option value='Pará' title='Pará'> PA </option>" +
"<option value='Paraíba' title='Paraíba'> PB </option>" +
"<option value='Paraná' title='Paraná'> PR </option>" +
"<option value='Pernambuco' title='Pernambuco'> PE </option>" +
"<option value='Piauí' title='Piauí'> PI </option>" +
"<option value='Rio de Janeiro' title='Rio de Janeiro'> RJ </option>" +
"<option value='Rio Grande do Norte' title='Rio Grande do Norte'> RN </option>" +
"<option value='Rio Grande do Sul' title='Rio Grande do Sul'> RS </option>" +
"<option value='Rondônia' title='Rondônia'> RO </option>" +
"<option value='Roraima' title='Roraima'> RR </option>" +
"<option value='Santa Catarina' title='Santa Catarina'> SC </option>" +
"<option value='São Paulo' title='São Paulo'> SP </option>" +
"<option value='Sergipe' title='Sergipe'> SE </option>" +
"<option value='Tocantins' title='Tocantins'> TO </option>" +
"</select>   </p>" +
"<p class='form2'><label> BATISMO: </label><br>" +
"<input type='text' id='batismo'>   </p>" +
"<p class='form2'><label> VALIDADE: </label><br>" +
"<input type='text' id='validade'>   </p>" +
"<div class='limpar'>" +
"<input type='reset' value='LIMPAR'/>" +
"</div>" +
"</form>" +
"</div>" +
"</div>" +
"</div>" +
"</body>" +
"</html>"
)
}
document.write(
"<div class='submit'>" +
"<div class='btnsub'>"+
"<input onclick='validacao()' type='submit' value='ENVIAR'/>" +
"</div>" +
"</div>"
)
return
}
}
for(i=0; i<qtd.length; i++){
if(qtd[i].checked == false){
alert("VOCÊ PRECISA ESPECIFICAR A QUANTIDADE!")
return
}
}
I even understood what you proposed, but I do not think it's quite what I wanted.
There in // Link javascript, I would like to put this:
<script type="text/javascript" src="lib/jquery.js"></script>
<script src="lib/maskedinput-1.3.js" type="text/javascript"></script>
<script src="lib/mascara.js" type="text/javascript"></script>
However, with "all" my options and my ability exhausted, I have no idea.
I get the impression that it's silly and simple, but I can not resolve it.
I have tried to create through DOM, concatenate the "scr" + "ipt" and nothing.
I'm accepting tips, criticisms, suggestions.