This is probably a very basic question, but I could not get my way around this. I have the following defined in MainPage.jsp file.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<frameset rows="44,*,26" cols="*">
<frame src="SubFrame1.jsp" name="SubFrame1" scrolling="no" id="SubFrame1" />
<frame src="SubFrame2.jsp" id="SubFrame2" title="SubFrame2" />
</frameset>
<noframes>
<body style="overflow:hidden">
</body>
</noframes>
</html>
How can I access any element defined in one sub frame page (E.g. SubFrame1.jsp) from another (E.g. SubFrame2.jsp)?
Thank you.
You can do this with
javascript. Useparent.frame_name. Here you can find a example.EDIT:
Assuming that you have one input called “someinput” in the subframe one:
You can access the value in the subframe two by javascript:
But be aware that using frames is obsolate option. It’s better to divide your content with
divsand usecssto the style of them.