Guest rycfung Posted February 19, 2006 Share Posted February 19, 2006 Hi,I'm trying to change the content of one frame from another using javascript. I've read some example online and they seem to work by using the parent or top attribute. However, I got the error "top.frame has no properties" in my firefox javascript console. How come?Here's my code:INDEX.XHTML<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Calendar </title> </head> <body> <frameset cols="25%, 75%"> <frame name="inter" src="interface.xhtml"/> <frame name="calendar" src="calendar.xhtml"/> </frameset> </body></html>INTERFACE.XHTML<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Interface </title> <script language="JavaScript" type="text/javascript"> </script> </head> <body> <h1> Interface </h1> </body></html>CALENDAR.XHTML<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Calendar </title> <script language="JavaScript" type="text/javascript"> function test() { //str=top.inter.toString(); top.frame[0].document.getElementsByName("h1")[0].innerHTML="interface.xhtml"; } </script> </head> <body onload="test();"> <h1> Calendar </h1> </body></html> Link to comment Share on other sites More sharing options...
Webworldx Posted February 28, 2006 Share Posted February 28, 2006 top.frames[*] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now