Hi, I am trying code MTMOutputString += '<a href="#" onclick="parent.frames[\'text\'].toggleNav(true);return false"><img alt="Close" align="right" src="'+CloseMenuIconSrc+'" border="0" width="16" height="16"/></a>'; MTMOutputString += '<a href="#" onclick="parent.frames[\''+MTMCodeFrame+'\'].location.reload();"><img alt="Refresh" align="right" src="'+RefreshMenuIconSrc+'" border="0" width="16" height="16"/></a><br>\n'; This works fine in IE but for mozilla firefox giving error text has no properties I have tried window.top.frames['framename'] parent.framename.toggleNav(true); But not works Please help me, Thanks in advance
The problem may be that "text" is a reserved JavaScript word. Or, is "text" the name of the frameset? There shouldn't be any JavaScript in the frameset document. onclick="parent.frames['text'].toggleNav(true);return false" And you shouldn't need to escape text.
I tried with changing name 'text' but not works, Actually I want to do is close frame on button click. It works first time when i click on button. But when i click second time it gives error has no properties. Please tell me if any other way to get frame
function is like this function toggleNav ( inNav ) { alert('inNav1 : ' + inNav); if ( inNav ) { alert('inNav2 : ' + inNav); newHREF = parent.frames['text'].location.href; newHREF = removeGet( 'body', newHREF ); newHREF = removeGet( 'view', newHREF ); alert('newHREF1 : ' + newHREF); parent.location.href = addGet( newHREF, 'view=normal'); } else { alert('inNav3 : ' + inNav); newHREF = location.href; newHREF = removeGet( 'body', newHREF ); newHREF = removeGet( 'view', newHREF ); alert('newHREF2 : ' + newHREF); location.href = addGet( newHREF, 'view=navigator'); } return false; } Actually clicking on that button closes navigator, and will display other frame 100%.
That's some 3rd party menu code, right? It's calling removeGet() and addGet() functions. Your problem is within one or both of those functions. I suggest you contact the vendor/author of that code. I have never heard of "closing" or "removing" a frame from a frameset. It seems to me that simply changing the height of a frame to 0px would be another way to achieve the effect. I can't help you with that 3rd party code.
Sanjay: I received your PM. The following works for me in FF and IE, "opening" and "closing" the left hand frame. Frameset document: <head> <title>An<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <frameset cols="30%, 70%" > <frame name="navFrame" scrolling="yes" src="nav.html"> <frame name="infoFrame" scrolling="yes" src="default.html"> </frameset> </html> Code (markup): navFrame, nav.html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html>y Title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript"> function closeNav(){ parent.document.getElementsByTagName('frameset')[0].cols = "0%, 100%"; } function openNav(){ parent.document.getElementsByTagName('frameset')[0].cols = "30%, 70%"; } </script> <style type="text/css"> body {background-color:#eae3c6;margin-top:60px} </style> </head> <body> <h1> Nav Frame </h1> <br><br><br> <br><br><br> <a href="#" onclick="closeNav();return false"> Close </a> </body> </html> Code (markup): infoFrame, default.html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Any Title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript"> </script> <style type="text/css"> body {background-color:#eae3c6;margin-top:60px} </style> </head> <body> <h1> Default </h1> <br><br><br> <br><br><br> <a href="#" onclick="parent.frames['navFrame'].openNav();return false"> Open </a> </body> </html> Code (markup):