Jump to content

Input 2 Input


busterkika
 Share

Recommended Posts

Boa tarde pessoal...

Estou a procurar um codigo em javascript que, tento 4 inputs e 1 checkbox, ao pressionar na checkbox me bloqueie 3 desses inputs e me copie o conteudo do 4 input para dentro dos outros 3 que foram desactivados.

Ja andei as voltas e não consegui resolver o meu problema.

Confesso que não pesco nada de javascript.

Desde ja agradeço a ajuda de todos 🙂

Link to comment
Share on other sites

Boas.

Experimenta isto :

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Teste</title>
<script language="JavaScript">
function honclick(CB)
{
if (CB.checked == true)
{
	var Text1 = document.getElementById("t1").value;
	for (var aa = 2; aa < 5; aa++)
	{
		var El = document.getElementById("t"+aa);
		El.value = Text1;
		El.disabled = true;
	}
}
else
{
	for (var aa = 2; aa < 5; aa++)
	{
		var El = document.getElementById("t"+aa);
		El.value = "";
		El.disabled = false;
	}
}
}
</script>
</head>
<body>
<input type="text" id="t1" />
<input type="text" id="t2" />
<input type="text" id="t3" />
<input type="text" id="t4" />
<input type="checkbox" onclick="honclick(this)" />
</body>
</head>
</html>

Se a vida te voltar as costas aproveita e apalpa-lhe o cu.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.