...

View Full Version : How to retrieve value from other page



makinha
10-18-2005, 11:13 AM
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



--------------------------
| 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



--------------------------
| |
| E |
| |
--------------------------

My question is how can I get retrieve the value in the text box "text1" from frame A ?

rm-f
10-18-2005, 02:43 PM
main.htm

<html>
<frameset cols="50%,50%">
<frame name="A" src="A.htm">
<frame name="C" src="C.htm">
</frameset>
</html>

A.htm

<html>
<body>
<h1>A frame</h1>
<form>
<input id="A_FORM_FLD1" type="text" value="A_FORM_FLD1 value">
</form>
</body>
</html>

C.htm

<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>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum