JavaScript - Acceder a variables i funciones de otro frame

 
Vista:

Acceder a variables i funciones de otro frame

Publicado por climentc (2 intervenciones) el 13/07/2001 17:48:01
Quisiera saber si se puede y cómo acceder a funciones y variables desde un frame a otro.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Acceder a variables i funciones de otro frame

Publicado por Jujo (37 intervenciones) el 13/07/2001 20:02:58
Te voy a dar un codigo para q acceses una direccion en un frame diferente a donde estas para que jueges con el, y encuentres loq ue necesitas.
La sintaxis es la siguente:

parent.izq.location.href="sizq.htm"

donde izq es el nombre de tu frame

Para accesar variables saria algo asi:

parent.izq.variable.value

para que te despliege es valor seria:

window.alert(parent.izq.variable.value)

Suerte

JJ
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Acceder a variables i funciones de otro frame

Publicado por Nano (53 intervenciones) el 13/07/2001 20:27:01
Como bien lo menciona Jujo, eso es posible, para que juegues un poco:
<html>
<head>
<title>Tu Titulo</title>
</head>
<!-- frames -->
<frameset id="todo" rows="100,*" frameborder="0" border="0">
<frame name="arriba" src="top.html" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" border="0">
<frameset id=marco" cols="200,600" frameborder="0" border="0">
<frame name="left" src="left.html" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" border="0">
<frame name="main" src="main.html" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" border="0">
</frameset>
</frameset>
</html>

top.html
<html>
<head>
</head>
<body>
<center>
Top Frame
</center>
</body>
</html>

left.html
<html>
<head>
<script>
function refreshing() {
for(i=1;i<=2;i++)
eval("parent.main.document.myForm.text"+i+".value=document.myForm.text"+i+".value;");
}
</script>
</head>
<body onLoad="window.open('popup.html','myPopUp','width=500,height=200');setInterval('refreshing()',1);">
<center>
Left Frame
</center>
<form name="myForm">
<input type="text" name="text1">
<input type="text" name%
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar