bom é o seguinte tou a tentar fazer em que com a checkbox selecionada irá activar o textfield que esta desactivada so que o problema é k nao esta a funcionar no ciclo WHILE... quer dizer penso k seja disso...
codigo:
- Código: Seleccionar todos
<script>
function disableField(myField)
{
myField.disabled = true
return true
}
function enableField(myField)
{
myField.disabled = false
return true
}
function onfocusField(myField)
{
if (myField.disabled)
{
myField.blur()
return false
}
return true;
}
// The above functions are generic, the following function is specific to this page
function toggleFields(myField)
{
if (myField.checked)
{
disableField(document.forms["example1"].datain)
}
else
{
enableField(document.forms["example1"].datain)
}
document.forms["example1"].datain
}
if (myField.checked)
{
disableField(document.forms["example1"].dataout)
}
else
{
enableField(document.forms["example1"].dataout)
}
document.forms["example1"].dataout
}
</script>
</head>
<bodyb>
<br><div align="center" id="box"><strong><?=$_SESSION['nome'].'-'.$_SESSION['localidade']?></strong></div>
<br>
<div align="center"><strong>Campanhas</strong></div>
<br>
<table width="98%" border="0" cellspacing="1" cellpadding="0">
<form name="example1" method="post" >
<tr>
<td width="19%" id="headerT">Campanhas</td>
<td width="4%" id="headerT">In</td>
<td width="4%" id="headerT">Out</td>
<td width="10%" id="headerT">Entrada</td>
<td width="6%" id="headerT">Saída</td>
<td width="57%" id="headerT"> </td>
</tr><?php
$sel="SELECT c.campanha
FROM tbl_campanhas c, tbl_campasaloca ca
WHERE ca.estado=0
AND ca.idCliente=".$_SESSION['idCliente']."
AND ca.campanha=c.idcam";
$stmt=mysql_query($sel, $conDb);
#echo $sel;
while($row=mysql_fetch_array($stmt))
{
?>
<tr>
<td id="bodyT"><?=$row['campanha']?></td>
<td id="bodyT"><input type="checkbox" name="incheck" onclick="toggleFields(this)" checked="checked"></td>
<td id="bodyT"><input type="checkbox" name="outcheck" onclick="toggleFields(this)" checked="checked"></td>
<td id="bodyT"><input type="text" name="datain" size="10" onfocus="return onfocusField(this)"></td>
<td id="bodyT"><input type="text" name="dataout" size="10" onfocus="return onfocusField(this)"></td>
<td id="bodyT"> </td>
</tr>
<?php
}
?>
<tr>
<td colspan="6"><div align="center"><span class="style9"><?=$msg?></span></div></td>
</tr>
<tr>
<td colspan="6"> </td>
</tr>
<tr>
<td colspan="6">
<div align="center">
<input type="submit" name="Submit" value="Gravar!">
Voltar: <a href="welcome.php"><img src="images/setalalanja.PNG" width="23" height="20" border="0"></a> </div></td>
</tr></form>
</table>
<script>
disableField(document.forms["example1"].datain)
disableField(document.forms["example1"].dataout)
</script>
</body>
</html>
nao sei onde esta o problema... ou entao nao funciona mesmo dentro do ciclo WHILE.... sera que que poderiam dar-me uma ajuda?
agradeço

