[Javascript] problem with parent

Laurent Muchacho LaurentM at london.virgin.net
Fri Sep 3 10:09:57 CDT 2004


Hi Alexis

personally I will have use top as top refer to the top window and parent
refer to the parent window in your case it will work but don't get confuse
when you get more complicated frameset
You need to access the document in the frame that's why in NS mozilla it
doesn't work the way you done it earlier try this syntax
top.frame2.document.testForm.textField.value

just in case I built an examples pages

http://www.be-lovely.co.uk/examples/frames/default.html

Regards

Laurent

-----Original Message-----
From: Alexis Doublier [mailto:alexis at 2000ecoles.net]
Sent: 03 September 2004 15:53
To: javascript at LaTech.edu
Subject: [Javascript] problem with parent


Hi,
I trye to display an information from a select object of a first frame
to a text input object of a seccond frame. so in my script of the first
frame i use this:
parent.frame2.form.text.value=MyValue

But javaconsol return to me this error:
parent.frame2 has no property


Some one have an idea of the mystake?
thanks a lot.
Alexis

My source:
 
index.html:

<html>
<frameset col="50%,*">
<frame name="frame1" src="in.html">
<frame name="frame2" src="out.html">
</frameset>
</html>

in.html:

<html>
<script  LANGUAGE="JavaScript">
function getIn(){
	var i;
	i=document.form1.select.selectedIndex;
	parent.frame2.form2.texte.value=document.form.select[i].value;
}
</script>
<body>
	<form name="form1" method="post" >
		<select name="select" size="1" onchange=getIn() >
			<option value="value1">option1</option>
			<option value="value2">option2</option>
			<option value="value3">option3</option>
		</select>
	</form>
</body>
</html>

out.html:
<html>
<body>
	<form name=form1 method="post">
		<input type="texte" name="texte" />
	</form>
</body>
</html>
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript


This E-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.  If you have received this E-mail in error please notify the system manager.  This message contains confidential information and is intended only for the individual named.  If you are not the named addressee you should not disseminate, distribute or copy this E-mail.



More information about the Javascript mailing list