Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here is the code for javascript frames would like to add counter on page counter.html and radio button on another page radio.html and if correct radio button is clicked counter is incremented on counter.html . Already have a seperate pages radio.html and counter.html would want them on same page with javascript frames

<head>
<title>Frames</title>
<script>

</script>
</head>
<frameset rows="24%,52%,24%" cols="33%,33%,34%" onload="">
<frame name="f1" src="javascript:''">
<frame name="f2" src="counter.html">
<frame name="f3" src="javascript:''"">
<frame name="f4" src="javascript:''">
<frame name="f5" src="radio.html">
<frame name="f6" src="javascript:''">
<frame name="f7" src="javascript:''">
<frame name="f8" src="javascript:''">
<frame name="f9" src="javascript:''">
</frameset>


What I have tried:

tried changing the path of counter object
Posted
Updated 5-Jan-18 1:56am
v2
Comments
Karthik_Mahalingam 5-Jan-18 5:51am    
not clear.
A_Griffin 5-Jan-18 7:10am    
You do realise framesets are no longer supported in html5 ? You really should not be using them. Use the iframes instead.

1 solution

you can access the iframe element of a parent page using
JavaScript
var fra = parent.document.getElementById("f2");
(assuming f2 is the id of the frame you want in this case)
You can then get the document object of that frame using:
JavaScript
var doc = fra.contentDocument || fra.contentWindow.document;
You can then get elements (objects) within that as usual:
JavaScript
var el = doc.getElementById("whatever");
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900