Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to retrieve value from other page

    Hello

    If I have a nested frames page "index.html", and have contained the frames as shown (A.html, B.html, C.html, D.html) with frame name (A, B, C, D).

    http://localhost/index.html

    Code:
    --------------------------
    |           A            |
    |------------------------|
    |  B  |         C        |
    |     |                  |
    |------------------------|
    |              D         |
    -------------------------
    when the user click on a link on frame C, it will launch a window with E.html, and would generate a values in the text box field named "text1" e.g. 111, so it should look like document.form1.text1.value='111'

    http://localhost/E.html

    Code:
    --------------------------
    |                        |
    |                E       |
    |                        |
    --------------------------
    My question is how can I get retrieve the value in the text box "text1" from frame A ?

  • #2
    Regular Coder
    Join Date
    Aug 2005
    Location
    Toronto, ON, Canada
    Posts
    231
    Thanks
    0
    Thanked 0 Times in 0 Posts
    main.htm
    Code:
    <html>
    <frameset cols="50%,50%">
    	<frame name="A" src="A.htm">
    	<frame name="C" src="C.htm">
    </frameset>
    </html>
    A.htm
    Code:
    <html>
    <body>
    	<h1>A frame</h1>
    	<form>
    	<input id="A_FORM_FLD1" type="text" value="A_FORM_FLD1 value">
    	</form>
    </body>
    </html>
    C.htm
    Code:
    <html>
    <head>
    <script>
    function f1() {
    	//alert(window.parent.frames.length);
    	var frameA;
    	for(var i=0; i<window.parent.frames.length; i++) {
    		if(window.parent.frames[i].name == 'A') {
    			frameA = window.parent.frames[i];
    			alert(frameA.document.getElementById('A_FORM_FLD1').value);
    		}
    	}
    }
    </script>
    </head>
    <body>
    	<h1>C frame</h1>
    	<button onclick="f1();">Show A-&gt;FORM-&gt;FLD1 val</button>
    </body>
    </html>
    rm -f /


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •