Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/09/2010, 10:40
negrocebollin
 
Fecha de Ingreso: septiembre-2010
Ubicación: Madrid
Mensajes: 44
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: Pasar variable obtenida en JS a campo HTML

Gracias _Cronos2 por la respuesta, me ha sido de gran ayuda, sin embargo tengo otra pregunta relacionada:

Ahora estoy intentando con ese JS darle valor a un campo data en un object y a un campo src de un iframe (se que es antiguo).

Al hacer en JS lo siguiente, la línea del src me devuelve error en Firebug:

<html><head><title> Prueba iFrame </title>

<script src="metadata.js" type='text/javascript'></script>
<script type="text/javascript">
function getMetaDataID()
{
document.getElementById("vid_frame").data='http://www.xxx.es/embed/index.php?Meta='+MetaDataID;

--Esta línea da error.
document.getElementById("vid_frame_src").src='http ://www.xxx.es/embed/index.php?Meta='+MetaDataID;
return MetaDataID;
}
</script>

</head>
<body onload="getMetaDataID()">


<!--[if lte IE 8]>
* * * *<iframe id='vid_frame_src' src="" style="width:450px;height:253px;position:absolute; top:0px; left:0px; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;" scrolling='no' *frameborder='0' allowtransparency='yes'>

* * * * * *<p>xxx</p>
* * * *</iframe>
* * *<![endif]-->

* * *<!--[if gt IE 8]>-->
* * * *<div> * * *
<object id='vid_frame' type="text/html" data="" title="xxx" style="width:450px;height:253px;position:absolute; top:0px; left:0px; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;">

<p>xxx</p>
* * * *</object></div>
* * *<!--<![endif]-->

</body></html>

¿Qué estoy haciendo mal? Es posible hacer esto con object e iframe??