Scholieren.com forum

Scholieren.com forum (https://forum.scholieren.com/index.php)
-   Software & Hardware (https://forum.scholieren.com/forumdisplay.php?f=20)
-   -   [DOM] Form elementen aanroepen buiten frame (https://forum.scholieren.com/showthread.php?t=461287)

Kermit the frog 29-04-2003 07:47

[DOM] Form elementen aanroepen buiten frame
 
Weet iemand hoe je form elementen kunt bereiken via een document in een ander frame. Stel ik heb een frameset van 2 rijen, en in frame 1 is een form "submitForm" met een textarea "text". Nu wil ik dus vanuit het document in frame 2 dit element aanroepen.

-niels- 29-04-2003 11:10

<form action="pagina.htm" method="post" target="cart">

target is de naam van je frame...

Triloxigen 29-04-2003 11:16

Citaat:

-niels- schreef op 29-04-2003 @ 12:10:
<form action="pagina.htm" method="post" target="cart">

target is de naam van je frame...

Volgens mij bedoeld ie dat niet..

Kermit the frog 29-04-2003 14:54

Dat bedoelde ik idd niet helemaal. Mijn uitleg klopte ook niet. Ik bedoelde eigenlijk een document met daarin een IFRAME. Vanuit het IFRAME moet de elementen in het "parent" document beschikbaar worden...

Triloxigen 29-04-2003 15:04

Ikw eet wel hoe je naar een parent frame naar ene form kan schrijven, maar niet hoe je iets op moet vragen..

iamcj 30-04-2003 08:03

window.frames['framename'].document.forms[0].textarea.value???

deathz0rz 30-04-2003 09:44

ik heb ergens gelezen dat je maar beperkt elementen in een ander frame kan aanroepen, of dat nou het moeder- of childframe is boeit niet

edit:

frames

---------------------------------------------

Description

Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window.

Syntax
object.frames(index)

Parameter Description
object Either the document or window object.
(index) Optional. An integer or a string specifying the index value of the window to retrieve. Integer indexes are zero-based, meaning the first window in the collection has index 0. A string index is valid only if the string is the name of one window in the document.


Remarks

If the HTML source document contains a BODY tag, the collection contains one window for each IFRAME element in the document. If the source document contains FRAMESET tags, the collection contains one window for each FRAME tag in the document. In both cases, the order is determined by the HTML source.

This collection contains window objects only and does not provide access to the corresponding FRAME and IFRAME elements. To access these elements, use the all collection for the document containing the elements.

Although you can use names with the item method on this collection, the method never returns a collection. Instead, it always returns the first window having the given name. To ensure that all windows are accessible, you should always make sure that no two windows in a document have the same name.

Kermit the frog 01-05-2003 08:47

Citaat:

iamcj schreef op 30-04-2003 @ 09:03:
window.frames['framename'].document.forms[0].textarea.value???
Ja, die wist ik al. Maar dat gaat alleen op voor de elementen in het IFRAME. Je kunt het niet andersom doen want het 'parent' window heeft immers geen ID of NAME tag.
Nu heb ik wel een property kunnen vinden op MSDN maar deze werkt alleen op IE 6+ (document.parentWindow red.).
De truc is om vanuit een child object (IFRAME in dit geval) het 'parent' object als variabele te initialiseren. Ik kom er in iedergeval niet uit.

Kermit the frog 01-05-2003 09:28

Laat maar. Ik heb het al gevonden, en het was bijna te simpel voor woorden :o

parent.[ functie ]

of

top.[ functie ]

...zo makkelijk zul je ze bijna niet meer krijgen :D :o


Alle tijden zijn GMT +1. Het is nu 22:17.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.