Ver Mensaje Individual
  #5 (permalink)  
Antiguo 24/09/2005, 14:45
furoya
(Desactivado)
 
Fecha de Ingreso: noviembre-2002
Ubicación: Ciudad Autónoma de Buenos Aires
Mensajes: 2.367
Antigüedad: 21 años, 6 meses
Puntos: 317
Hola sanapo , flaviovich :

No sé si entiendo. Pero cuendo uno quiere revisar el contenido de su página (especialmente para descubrir algún error) se usa un bookmarklet desde la addressbar.

Este sería un ejemplo de página

Código:
<HTML>
<head>
<script>
function mifuncion(){
document.write("<p id='generado'> saludos </p>");
}
</script>
<style>
#generado{color:#000;}
#d0{border:3px solid red;}
#d1{border:3px solid green;}
#d2{border:3px solid blue;}
#d3{border:3px solid silver;}
#d4{border:3px solid black;}
div{padding:2px; text-align:center}
</style>
</head>
<body>
<p>unas cuantas lineas más</p>
<p>unas cuantas lineas más</p>
<p>unas cuantas lineas más</p>
<p>unas cuantas lineas más</p>
<script>mifuncion()</script>

<br /><br /><br />

<div id="d4">qweryup4
<div id="d3">qweryup3
<div id="d2">qweryup2
<div id="d1">qweryup1
<div id="d0">qweryup0
</div>
</div>
</div>
</div>
</div>
<br />
</body>
</html>
Y estos algunos bookmarklets de ejemplo

Código:
 
<!-- 		TODOS PARA IE

	PARA VER EL CONTENIDO DE LA ETIQUETA, USANDO ID
javascript:alert(document.getElementById("generado").innerHTML)


	PARA VER EL CONTENIDO Y LA ETIQUETA, USANDO ID
javascript:alert(document.getElementById("generado").outerHTML)


	PARA VER EL CONTENIDO Y LA ETIQUETA, USANDO EL INDEX DE TAG
javascript:alert(document.getElementsByTagName("p")[4].outerHTML)


	PARA VER LOS CONTENIDOS Y LAS ETIQUETAS, USANDO COLECCIÓN DE TAGS CON INDEX DE PÁRRAFO
javascript:var%20bW2Ks='';for(q=0;q<document.getElementsByTagName("p").length;q++){bW2Ks+=document.getElementsByTagName("p")[q].outerHTML+'\tP'+q+'\r\n'};alert(bW2Ks)


	PARA VER COLOR ASIGNADO EN ESTILO O DEFAULT
javascript:alert('color:'+document.getElementById("generado").currentStyle.color)


	PARA VER LOS CONTENIDOS Y LAS ETIQUETAS, USANDO COLECCIÓN DE TAGS EN NUEVA VENTANA
javascript:var%20bW2Ks='';for(q=0;q<document.getElementsByTagName("p").length;q++){bW2Ks+=document.getElementsByTagName("p")[q].outerHTML+'\r\n'};var%20mJ2Ft=open();mJ2Ft.document.write('<PLAINTEXT>'+bW2Ks);void(0)


	PARA CONOCER EL NÚMERO DE INDEX GENERAL, CON DOBLECLICK
javascript:void(window.document.ondblclick=function(){prompt(window.event.srcElement.innerHTML,window.event.srcElement.sourceIndex)})


	PARA VER EL CONTENIDO POR NÚMERO DE INDEX GENERAL
javascript:alert(document.all[prompt('Escriba%20Index%20general%20en%20documento%20:','')].innerHTML)

Nota :	el escript que contiene miFuncion() tiene index 3
¯¯¯¯	el escript que ejecuta miFuncion() tiene index 10


	PARA VER EL CONTENIDO Y LA ETIQUETA, CON DOBLECLICK
javascript:void(window.document.ondblclick=function(){alert(window.event.srcElement.outerHTML)})


	PARA VER EL CONTENIDO HASTA UN NIVEL DE parentElement, CON DOBLECLICK
javascript:void(window.document.ondblclick=function(){var%20qF6Ju=window.event.srcElement;var%20gH6Px=qF6Ju;var%20dS4Iy=0;while(gH6Px.tagName!='HTML'){gH6Px=gH6Px.parentElement;dS4Iy+=1};var%20kH7Oy=prompt('¿Hasta%20qu%e9%20nivel%20desea%20ver?\r\nMaximo%20:',dS4Iy);if(kH7Oy){for(m=0;m<kH7Oy;m++){qF6Ju=qF6Ju.parentElement};alert(qF6Ju.outerHTML)}})


-->
Los códigos en azul se copian y pegan en la barra de direcciones y se ejecutan con un click. No tienen espacios, si aparece alguno agregado por el editor del foro, hay que borrarlo.

Saludos

furoya

Última edición por furoya; 29/09/2005 a las 09:52 Razón: agragar código.