Ver Mensaje Individual
  #7 (permalink)  
Antiguo 30/09/2010, 14:50
wilo087
 
Fecha de Ingreso: agosto-2009
Mensajes: 78
Antigüedad: 14 años, 7 meses
Puntos: 2
Respuesta: Se puede recuperar el atributo src de un iframe o una etiqueta img?

Bueno para lo que queria dicha funcion era para sacar el valor del atributo src de un iframe.

Para que queria esto? pues estoy cargando sitios web's por medio de un iframe con un pequeño header, la idea era hacer un pequeño script que me permitiera sacar la url que tenia el iframe en ese momento para poder poner un boton que diga: Elimimar esta barra o eliminar el header. Bueno aqui dejo el codigo de como lo hice por si alquien le funciona.

Tambien un pequeño hack que utilizaba google para hacer esto mismo que estoy haciendo ahora.

Código HTML:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<style>
html{height:100%}
body{
font-family:Tahoma, Geneva, sans-serif;
margin:0; 
height:100%;
overflow:hidden
}
a,a:visited{color:#F90;}
img{border:none}
table{font-size:100%}
.sombra{
	-moz-box-shadow: #000000 0 0 30px;
	-webkit-box-shadow: #000000 0 0 30px;
	-khtml-box-shadow: #000000 0 0 30px;
	box-shadow: #000000 0 0 30px;
}

</style>

<script>
function test() {
var imagen = document.getElementById('blockrandom');
window.location=imagen.src;
}
</script>
</head>
<body>

<table cellpadding=0 cellspacing=0 height="100%" width="100%">
	<tr height="1%">
			<td valign="top" style="top:0;width:100%">

<table cellpadding=0 cellspacing=0 width="100%" style="background-color:#FFF; height:150px">
        <tr >   
          <td style="border-bottom:solid 3px #F90;" align="center" valign="bottom">
<table width="1021" border="0" cellspacing="2" cellpadding="0">
  
  <tr>
    	<td  class="sombra" height="60" align="center"><a href="javascript:void(0)" onClick="javascript:test('blockrandom');" style="text-decoration:none; font-family:Tahoma; font-weight:bold; font-size:26px; color:#F90">Eliminar Marco</a>
    	  <p><a href="http://www.forosdelweb.com" style="text-decoration:none; font-family:Tahoma; font-weight:bold; font-size:12px; color:#F90">Volver Atrás</a></p>
    	  <p>&nbsp;</p></td>
		</tr>   
</table>

         </td>
          </table>
          <tr>


<!--El hack consiste en esto: en poner el contenido dentro de un celda si haber aperturado una columa-->
          <td>
<iframe id="blockrandom" src="http://www.forosdelweb.com/f13/puede-recuperar-atributo-src-iframe-etiqueta-img-846605/#post3578863" style="width:100%; height:100%;"> </iframe>
</td>

</table>
</body>
</html> 

Espero que le funciona a elguien

Gracias.