El return lo he colocado por que he leido que necesitaba un return. Estoy intentando ver como hacerlo funcionar sin molestar mucho, pero no lo consigo.
he modificado el codigo ahora me da esto
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<script type="javascript">
function PasarId(id){
var imgselect = document.getElementById(id);
document.getElementById(img).value = imgselect;
}
</script>
<link href="../css/regalo.css" rel="stylesheet" type="text/css" />
</head>
<body class="fondo">
<div class="nada" id="nada">¡Enviale un regalo y gana su atención!</div>
<div class="fondo" id="fondo">
<div class="fondo" id="fondo1">
<form id="form1" name="form1" method="post" action="">
<table>
<tr>
<td>
<img src="../images/regalos/beso.png" alt="1" name="dd" width="65" height="65" id="1" onclick=PasarId('1'); />
1
<img src="../images/regalos/rosa.png" alt="2" name="dd" width="65" height="65" id="2" onclick=PasarId('2'); />
2
<img src="../images/regalos/bombones.png" alt="3" name="dd" width="65" height="65" id="3" onclick=PasarId('3'); />
3
<img src="../images/regalos/carta.png" alt="4" name="dd" width="65" height="65" id="4" onclick=PasarId('4'); />
4
<img src="../images/regalos/cereza.png" alt="5" name="dd" width="65" height="65" id="5" onclick=PasarId('5'); />
5
<img src="../images/regalos/flores.png" alt="6" name="dd" width="65" height="65" id="6" onclick=PasarId('6'); />
6
</td></tr></table>
<p>Tu comentario
<label>
<input name="img" type="text" id="img" >
</label>
</p>
<p>
<label>
<textarea name="comentario" id="comentario" cols="45" rows="5"></textarea>
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="Regalar" />
</label>
</p>
</form>
</div>
</div>
</body>
</html>
Pero me da el mismo error
Código PHP:
PasarId is not defined
function onclick(event) { PasarId("5"); }()1 (línea 2)
[Break on this error] PasarId("5");
A ver si con esto te oriento mejor.
Gracias