2
Setting
I have two pages .html
. On one of the pages I have two options of brand radio
both have id
, are they XPTO and YPTO e. What I need to do is, when choosing XPTO and then press the button register, he has to disable a field on the other page.
In my example the field is called Surname, for this I was using a condition in the javascript If document.getElementById("xpto").textContent
for this element, on the other page the field Surname vanishes.
Is there any way to do that, even though I’m going to another page next?
My codes below:
PAGE 1: test.html
<body>
<table border="1">
<tbody>
<tr>
<td><input type="radio"></td>
<td><input type="radio"></td>
</tr>
<tr>
<td id="xpto">XPTO</td>
<td id="ypto">YPTO</td>
</tr>
</tbody>
</table>
<br /><br />
<button><a href="test2.html" onclick="disableSobrenome()">CADASTRAR</a></button>
</body>
PAGE 2: test2.html
<body>
<form>
Nome:
<input type="text" id="nome">
Sobrenome:
<input type="text" id="sobrenome">
</form>
<a href="test.html">VOLTAR</a>
</body>
Script.js:
function disableSobrenome() {
if (document.getElementById("xpto").textContent)
{
document.getElementById("sobrenome").style.display='none';
}
}
http://answall.com/a/89350/23400 might help...
– gustavox
@gustavox, thank you, using this article you quoted, I was able to mix with the solution presented on the page, +1.
– DevRyu