JavaScript - Can One Link Load 2 Frames Plus Their Frameset?
With the help of Aerospace_Eng in a 2005 codingforums thread, now I can use one link (for example in a page about Topic 3) to load two related pages about Topic 4 (left-4.htm and right-4.htm) into the “left” and “right” iframes, using the code below.
___Is it possible to use this code, suitably supplemented, to also specify the frameset at “home.htm” if an external link to “right-4.htm” loads it into a browser without the frameset? (i.e. by putting a link into right-4.htm that will load it and left-4.htm into the iframe-context of home.htm) Code: <head> <script> function changeLink(link) { parent.right.location=link; } </script> </head> <body> <a href="left-4.htm" target="left" onclick="changeLink('right-4.htm'); return true">for Topic 4</a> </body> Similar TutorialsHello Again, After much help and support i have decided that the best way to do what i want (if i can get it working is like the below). The idea is to click a link and content will load into a div from another div on another page in the same webspace. I can make a test page as directed by the guidance i recieved but there are some features that wont work properly or are not what i am after. For example in the test case the link to load the div is inside the div i want to update. In my case i want to click on the algebra link in the blue horizontal menu and then the main menu updates. I wont lie i have not got the skills to adapt this script on my own. here is the test page http://www.bushcottages.co.uk/loaddata.htm the main page i would like it to work on as its not working correctly is http://www.bushcottages.co.uk/new.htm test code is Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Click This Link To Load My Favor</title> <script type="text/javascript" src="java/jquery-1.5.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#loadData").click(function() { $(this).text("...One Moment Please..."); $("#container").append('<div id="favoriteMovies"></div>') .children("#favoriteMovies").hide() .load("theOtherPage.htm ul#favoriteMovies", function() { $("#loadData").remove(); $("#favoriteMovies").slideDown("slow"); }); return false; }); }); </script> <style type="text/css"> #container { width: 300px; height: 200px; font-family: georgia; font-weight: bold; border-style: solid; border-width: 2px; border-color: #000066; } </style> </head> <body> <div id="container"> <li><a href="#" id="loadData">Click This Link To Load My Favorite Movies</a></li> </div> </body> </html> code for main page is Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Language" content="en-gb"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Mathematics Learning Zone</title> <meta name="description" content="Learn Key Stage 4 Mathematics and Achieve a Grade C."> <meta name="keywords" content="Maths, Mathematics, Key Stage 4, Key Stage 4 Maths, GCSE Maths, Maths Grade C"> <meta name="author" content="Peter Devlin"> <script type="text/javascript" src="java/jquery-1.5.min.js"></script> <script type="text/javascript" src="http://www.bushcottages.co.uk/java/jquery.newsTicker-1.2.2.js"></script> <script type="text/javascript"> <!-- $(document).ready(function() { if (document.getElementById('news')) { var options = { newsList: "#news", tickerRate: 20, loopDelay: 6000, startDelay: 10, placeHolder1: "_" } $().newsTicker(options); } }); --> </script> <script type="text/javascript"> $(document).ready(function() { //Default Action $(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active").show(); //Activate first tab $(".tab_content:first").show(); //Show first tab content //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active content return false; }); }); </script> <script type="text/javascript"> var newwindow; function poptastic(url) { newwindow=window.open(url,'brainteasersolution.htm','height=400,width=400,left=40%,top=20%'); if (window.focus) {newwindow.focus()} } </script> <script type="text/javascript"> $(document).ready(function() { $("#number").click(function() { $(this).text("...One Moment Please..."); $("#container").append('<div id="Algebra"></div>') .children("#Algebra").hide() .load("Algebra.htm ul#algebra", function() { $("#number").remove(); $("#Algebra").slideDown("slow"); }); return false; }); }); </script> <style type="text/css"> * { border: 0; margin: 0; padding-top:0; } #topmargin { width:900px; height:5px; margin:auto; } #banner { width: 900px; height: 70px; background-image: url('banner.png'); margin: auto; margin-bottom: 5px; background-color: #000066; } #horizontalmenu { width: 900px; height: 25px; margin: auto; margin-bottom: 5px; background-color: #000066; } #horizontalmenu ul { list-style-type: none; margin: 0px; padding: 2px 0px 0px 0px; } #horizontalmenu ul li { float: left; display: block; text-align: center; width: 300px; } #horizontalmenu ul li a { text-decoration: none; font-family: georgia; font-size: 1em; color: #fafafa; } #horizontalmenu ul li a:hover { font-family: georgia; font-size: 1em; padding: 5px 40px 5px; color: #000000; background-color: #ffffff; } #mainpage { width: 900px; margin: auto; } #one { float: left; width: 150px; margin-right: 5px; } #two { float: left; width: 590px; margin-right: 5px; } #three { float: left; width: 150px } #verticalmenu { float: left; width: 150px; } #verticaltopmenu { float: left; width: 150px; height: 23px; background-color: #000066; } #verticalmainmenu { float: left; width: 146px; height: 372px; text-decoration: none; border-style: solid; border-width: 2px; border-color: #000066; padding-top: 2px; padding-bottom: 2px; } #verticalmainmenu ul { text-decoration: none; list-style: none; padding: 0px; margin: 0px; color: black; } #verticalmainmenu ul li { list-style: none; text-decoration: none; display: block; padding: 0px; text-align: left; font-family: georgia; font-size: .8em; color: black; } #verticalmainmenu ul li a { padding: 0px 0px 0px 5px; text-decoration: none; text-align: left; color: black; } #verticalmainmenu a:hover { background-color: white; color: #000066; } #tickercontainer { float: left; width: 586px; height: 21px; margin-bottom: 5px; border-color: #000066; border-style: solid; border-width: 2px; } #tickersidetitle { float: left; width: 125px; height: 21px; background-color: #000066; } #tickercontent { float: left; width: 461px; height: 21px; padding: 0px; } ul#news { margin: 0px; height: 21px; padding: 0px 0px 0px 0px; } ul#news li { list-style: none; font-family: georgia; font-size: 14px; font-weight: bold; color: #004400; margin: 0px; padding: 0px 0px 0px 10px; } ul#news li a:link, ul#news li a:hover { color: #004400; text-decoration: none; } #contentwindow { float: left; width: 590px; } ul.tabs { width: 590px; /*--Set width of container--*/ height: 23px; /*--Set height of tabs--*/ margin: 0px; padding: 0px; float: left; list-style: none; border-bottom: 2px solid #000066; /*--Set line at bottom of ul--*/ } ul.tabs li { float: left; margin-right: 1px; /*adjusts gap between tabs*/ height: 23px; /*--Subtract 1px from the height of the unordered list--*/ line-height: 23px; /*--Vertically aligns the text within the tab--*/ margin-bottom: -2px; background: #000066; border-color: #000066; border-style: solid; border: 2px; } ul.tabs li a { text-decoration: none; color: #FFFFFF; font-family: georgia; font-size: 14px; display: block; padding: 0 20px; } ul.tabs li.active a { color:#000000; border-color: #000066; border-style: solid; border: 2px; } ul.tabs li a:hover { background-color: #330099; border: 0px; } ul.tabs li.active, ul.tabs li.active a:hover /*--Makes sure that the active tab does not listen to the hover properties--*/ { color: #000000; background: #FFFFFF; border-color: #000066; border-style: solid; border: 2px 2px 2px 0px; border-bottom: 2px solid #FFFFFF; /*--Makes the active tab look like it's connected with its content--*/ } .tab_container { border: 2px solid #000066; border-top: none; overflow: hidden; clear: both; float: left; width: 586px; height: 346px; background: #FFFFFF; } .tab_content { padding: 20px; font-size: 1.2em; } #testsmenu { float: left; width: 150px; margin-bottom: 5px; } #teststopmenu { width: 150px; height: 23px; background-color: #000066; } #testsmainmenu { float: left; width: 146px; height: 70px; border-style: solid; border-width: 2px; border-color: #000066; } #testsmainmenu ul { float: left; margin-top: 2px; margin-bottom: 2px; width: 146px; padding: 0px; } #testsmainmenu ul li { font-family: georgia; font-size: 0.8em; list-style-image: url('test.png'); margin-left: 30px; padding: 0px; text-align: left; } #testsmainmenu ul li a { padding: 0px; text-decoration: none; text-align: left; color: black; } #testsmainmenu ul li a:hover { background-color: white; color: #000066; } #downloadsmenu { float: left; width: 150px; margin-bottom: 5px; } #downloadstopmenu { width: 150px; height: 23px; background-color: #000066; } #downloadsmainmenu { float: left; width: 146px; height: 70px; border-style: solid; border-width: 2px; border-color: #000066; } #downloadsmainmenu ul { float: left; margin-top: 2px; margin-bottom: 2px; width: 146px; padding: 0px; } #downloadsmainmenu ul li { font-family: georgia; font-size: 0.8em; list-style-image: url('download.png'); margin-left: 30px; padding: 0px; text-align: left; } #downloadsmainmenu ul li a { padding: 0px 0px 0px 5px; text-decoration: none; text-align: left; color: black; } #downloadsmainmenu ul li a:hover { background-color: white; color: #000066; } #worksheetsmenu { float: left; width: 150px; margin-bottom: 5px; } #worksheetstopmenu { width: 150px; height: 23px; background-color: #000066; } #worksheetsmainmenu { float: left; width: 146px; height: 70px; border-style: solid; border-width: 2px; border-color: #000066; } #worksheetsmainmenu ul { float: left; margin-top: 2px; margin-bottom: 2px; width: 146px; padding: 0px; } #worksheetsmainmenu ul li { font-family: georgia; font-size: 0.8em; list-style-image: url('worksheet.png'); margin-left: 30px; padding: 0px; text-align: left; } #worksheetsmainmenu ul li a { padding: 0px 0px 0px 5px; text-decoration: none; text-align: left; color: black; } #worksheetsmainmenu ul li a:hover { background-color: white; color: #000066; } #weblinksmenu { float: left; width: 150px; margin-bottom: 5px; } #weblinkstopmenu { width: 150px; height: 23px; background-color: #000066; } #weblinksmainmenu { float: left; width: 146px; height: 70px; border-style: solid; border-width: 2px; border-color: #000066; } #weblinksmainmenu ul { float: left; margin-top: 2px; margin-bottom: 2px; width: 146px; padding: 0px; } #weblinksmainmenu ul li { font-family: georgia; font-size: 0.8em; list-style-image: url('links.png'); margin-left: 30px; padding: 0px; text-align: left; } #weblinksmainmenu ul li a { padding: 0px 0px 0px 5px; text-decoration: none; text-align: left; color: black; } #weblinksmainmenu ul li a:hover { background-color: white; color: #000066; } p { text-align: center; font-family: georgia; font-size: 1em; color: #FFFFFF; padding-top: 2px; } p.a { text-align: center; font-family: georgia; font-size: 1em; color: #FFFFFF; padding-top: 0px; } p.b { text-align: center; font-family: georgia; font-size: 1em; color: #000000; padding-top: 0px; } p.c { text-align: center; font-family: georgia; font-size: 8px; color: #000000; padding-top: 0px; } </style> </head> <body> <div id="topmargin"></div> <div id="banner"></div> <div id="horizontalmenu"> <ul> <li> <a href="#" id="number">Number and Algebra</a></li> <li><a href="url">Geometry and Measures</a></li> <li><a href="url">Statistics - Data Handling</a></li> </ul> </div> <div id="mainpage"> <div id="one"> <div id="verticalmenu"> <div id="verticaltopmenu"><p>Main Menu</p></div> <div id="verticalmainmenu"> <ul> <li><a href="url">Angles</a></li> <li><a href="url">Properties of Shapes</a></li> <li><a href="url">Circle Theorems</a></li> <li><a href="url">Geometry of Cuboids</a></li> <li><a href="url">2d and 3d Shapes</a></li> <li><a href="url">Area</a></li> <li><a href="url">Perimeter</a></li> <li><a href="url">Prisms</a></li> <li><a href="url">Surface Area</a></li> <li><a href="url">Using Pi</a></li> <li><a href="url">Volumes</a></li> <li><a href="url">Transformations</a></li> <li><a href="url">Scale</a></li> <li><a href="url">Coordinates</a></li> <li><a href="url">Vectors</a></li> <li><a href="url">Bearings</a></li> </ul> </div> </div> </div> <div id="two"> <div id="tickercontainer"> <div id="tickersidetitle"><p class="a">Brainteasers</p></div> <div id="tickercontent"> <ul id="news"> <li>How many Degrees in a Triangle?</li> <li><a href="javascript:poptastic('brainteasersolution.htm');">Algebra - What is 4x = 20 - X? Click for answer</a></li> <li><a href="http://www.bushcottages.co.uk/1.htm">What is the most common class Called?</a></li> </ul> </div> </div> <div id="contentwindow"> <ul class="tabs"> <li><a href="#tab1">Acute</a></li> <li><a href="#tab2">Obtuse</a></li> <li><a href="#tab1">Reflex</a></li> <li><a href="#tab2">Vertex</a></li> </ul> <div class="tab_container"> <div id="tab1" class="tab_content"> <p class="b">hello</p> <p class="c">Page Created by P.Devlin</p> </div> <div id="tab2" class="tab_content"> <p class="b">well done</p> <p class="c">Page Created by P.Devlin</p> </div> </div></div> </div> <div id="three"> <div id="testsmenu"> <div id="teststopmenu"><p>Online Tests</p></div> <div id="testsmainmenu"> <ul> <li><a href="url">Linear Graphs</a></li> <li><a href="url">Equations</a></li> <li><a href="url">Averages</a></li> <li><a href="url">Algebra</a></li> </ul> </div> </div> <div id="downloadsmenu"> <div id="downloadstopmenu"><p>Downloads</p></div> <div id="downloadsmainmenu"> <ul> <li><a href="url">Linear Graphs</a></li> <li><a href="url">Equations</a></li> <li><a href="url">Algebra</a></li> <li><a href="url">Tests</a></li> </ul> </div> </div> <div id="worksheetsmenu"> <div id="worksheetstopmenu"><p>Worksheets</p></div> <div id="worksheetsmainmenu"> <ul> <li><a href="url">Linear Graphs</a></li> <li><a href="url">Equations</a></li> <li><a href="url">Algebra</a></li> <li><a href="url">Tests</a></li> </ul> </div> </div> <div id="weblinksmenu"> <div id="weblinkstopmenu"><p>Web Links</p></div> <div id="weblinksmainmenu"> <ul> <li><a href="url">Linear Graphs</a></li> <li><a href="url">Equations</a></li> <li><a href="url">Algebra</a></li> <li><a href="url">Tests</a></li> </ul> </div> </div> </div> </div> </body> </html> Many thank to you all for your help so far. Peter Hi, I'm relativly new to JS and brand new to the forum so you might need to dumb down your replys for my slightly lacking knowledge. That being said I do have a very solid grasp of html, css and am getting there with JS and its various frameworks. I'm integrating wordpress into an existing site for a friend and currently have the main blog page appear in a DIV. This is the best way to integrate in this case due to many reasons mostly of way the site is constructed. Code: <div class="scroll-pane" id="scrollbox"> WORDPRESS BLOG </div> My issue is that links within that DIV, in the blog, when clicked redirect the page. The simple answer to this would be to have them just open in a new page, which I can easily do with the below code. Code: function Init() { // Grab the appropriate div theDiv = document.getElementById('scrollbox'); // Grab all of the links inside the div links = theDiv.getElementsByTagName('a'); // Loop through those links and attach the target attribute for (var i=0, len=links.length; i < len; i++) { // the _blank will make the link open in new window links[i].setAttribute('target', '_blank'); } } window.onload = Init; But what I'd rather it do is have any link clicked inside the DIV to reload in that same DIV, similar to an iframe, but obviously without using an iframe, due to it's compatibility issues. Is this possible by editing the above code? If not what do I need? Thanks in advance for any help! Hi all Is there a way to get the image(s) to load into the table after the page has loaded instead of the way I have it now? I have 4 tabs, but I would like the imgs in tabs 2,3,4 to load after page load. Example of how the tabs look. Code: <div class="tabbertab"> <h2>Australia_____</h2> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFCC"> <caption class="highlight_Red">澳洲 Australia </caption> <tr> <td><a href="pages/promotion.html#aus_ACE" rel="nofollow" target="_blank"><img src="pages/images/Pics/AUS/ace.jpg" alt="ACE / ATTC" width="110" height="69" border="0" align="left" class="ozimg_L"/> ...a few more images etc the other tabs look the same. LT This script displays a link to a registration/login form that loads in a light box for Joomla. I've been goin nuts trying to figure out how to get this to load on page load with a delay. Anyone know how to get this done? PHP Code: <?php JHTML::_('behavior.mootools'); $document = JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'media/system/css/modal.css'); $document->addScript(JURI::base() . 'media/system/js/modal.js'); $document->addScriptDeclaration("window.addEvent('domready', function() {SqueezeBox.initialize({});});"); $user = & JFactory::getUser(); $uri = JFactory::getURI(); $url = $uri->toString(); $return = base64_encode($url); ?> <div id="lbframeid" style="position:absolute;top:1px;left:1px;height:0px;width:0px;overflow:hidden"> <a href="http://www.wowjoomla.com/"><h1>Joomla Login LightBox powered by WowJoomla.com</h1> </a> </div> <?php if ($user->get('guest')) :?> <a href="<?php echo JRoute::_('index.php?option=com_loginbox')?>" onclick="SqueezeBox.fromElement(this); return false;" rel="{handler: 'iframe', size: {x: 660, y: 500}}"><?php echo JText::_('SIGNUP_LOGIN')?></a> <?php else: ?> <?php echo JText::sprintf( 'HINAME', $user->get('name') ); ?> <br> <a href="javascript:void(0);" onclick="LB_onLogout(); return false;"><?php echo JText::_('LOGOUT')?></a> <?php endif; ?> <script type="text/javascript"> function LB_onLogout() { var form = new Element('form'); form.setProperty('method', 'POST'); form.setProperty('target', '_self'); form.setProperty('action', 'index.php'); var input = new Element('input'); input.setProperty('type', 'hidden'); input.setProperty('name', 'option'); input.setProperty('value', 'com_user'); form.appendChild(input); var input = new Element('input'); input.setProperty('type', 'hidden'); input.setProperty('name', 'task'); input.setProperty('value', 'logout'); form.appendChild(input); var input = new Element('input'); input.setProperty('type', 'hidden'); input.setProperty('name', 'return'); input.setProperty('value', '<?php echo $return; ?>'); form.appendChild(input); $E('body').appendChild(form); form.submit(); } </script> Can someone help me with this? I have a frameset built as follows: <FRAMESET cols="20%, 80%"> <FRAME src="red.html"> <FRAMESET rows="100, 200"> <FRAME name="green" src="Green.html"> <FRAME name="blue" src="Blue.html"> </FRAMESET> Then I have a function built in the red.html page to set the frame[green] to the blue.html source location. attached to a button on the red.html form. <script language="javascript" type="text/javascript" > window.onload = function colorchange() { top.location.green="blue.html"; } </script> top.location.green="blue.html"; just does not seem to do anything.. Can someone help with this. I have a menubar across the top of a page in a separate frame. Content loads into main frame below it. I'm adding an onClick menu option that I'd like to open in the same, full window, without the menubar frame on top. Any way to do this? Thx. Hi: I got a blank page returned when using javascript within the Frameset. Here is part of my codes: (my javascript part) <script language="JavaScript"> //this function will be used to get the parameter from URL using javascript function gup (name) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; } //get the transactionID from the URL var transactionID = gup('name'); //add the transactionID as the URL parameter var url = "../../onetwothree/Approve.jsp?name=" + transactionID + '\"'; var temp = '<frame name=\"onetwothree\" ' + 'src=\"' + url + '>' + '</frameset>'; </script> ---------------------------- (my html part) <frameset rows="0,*" border="0" frameborder="0" framespacing="0"> <frame name="onetwothreeFrame" src="../onetwothree/abcd.html" marginwidth="0" marginheight="0" scrolling="no" noresize> <script language="JavaScript"> document.write(temp); </script> </frameset> Hi friends, <script language="JavaScript" > calDocFrameset = "<frameset rows='60,*' frameborder='0' sty >\n" + " <frame name='topCalFrame' src='javascriptarent.opener.calDocTop' scrolling='no'>\n" + " <frame name='bottomCalFrame' src='javascriptarent.opener.calDocBottom' scrolling='no'>\n" + "</frameset>\n"; document.write(calDocFrameset); </script> the above code i am using for popup calendar. It is working fine with IE.But it is not working in mozilla and GoogleChrome. In mozilla and gc it is comming in center. It is appearing only when i maximize the window. Even though i have given window properties as window.open('/includes/calendar.htm','cal','dependent=yes,width=180,height=180,left=400,top=250,titlebar=yes,resize=no'); I want the calendar to appear in popupwindow without maximizing. Srikanth Hi, I am completely aware that Framesets are an outdated way of designing these days (I don't have time to redesign the site now), but I have a question:. Is there a way I can have a "Please wait.. Loading.." message of some sort on the "contents.html" frameset? It takes a while to load.. Code: <html> <head> </head> <frameset rows="130,*" framespacing="0" border="0" frameborder="0"> <frame name="banner" scrolling="no" noresize target="contents" src="title.html"> <frameset cols="523,493"> <frame name="contents" target="main" src="contents.html" scrolling="auto"> <frame name="main" src="letters.html" scrolling="auto"> </frameset> <noframes> <body> <p>This page uses frames, but your browser doesn't support them.</p> </body> </noframes> </frameset> </html> Thanks so much. I have a main window which produces a number of child windows when I press a button. Users need to be able to switch between windows using Ctrl+Tab hot key. I was trying to implement this by intercepting keyup/keydown events in one of the frames. But the problem is that main window has several frames and I don't have access to all of them because some of them are in different domains. As soon as a user clicks on a frame without my handler the hot key is not working anymore. Any ideas how to implement it? Maybe an ActiveX component? If ActiveX could help me - how does it work? Are there any tutorials or examples how to write an activeX to intercepts hot keys in IE? Thank you. i have this frameset: http://www.mediafire.com/?75dvswgvelw19a9 this is somehow the like my other posts but im dealing with the radio buttons. what i want is when i click on the "create" button in form1 http://www.mediafire.com/?eld7a1rb21h799e it will pass the value to form 2 http://www.mediafire.com/?f0o060cdpyf06ya. so when i select "yes" in form1 and click on "create" it will autoselect "On" in form2. if i select "no" in form1 and click on "create" it will autoselect "off" in form2. Hi guys, I am trying to insert the following call into my page; Code: <script type="text/javascript" defer="true"> $('#query').autocomplete({ serviceUrl:'service/autocomplete.ashx', minChars:1, delimiter: /(,|;)\s*/, // regex or character maxHeight:400, width:250, deferRequestBy: 0, //miliseconds params: { country:'Yes' }, //aditional parameters // local autosugest options: lookup: ['January', 'February', 'March', 'April', 'May'] //local lookup values }); </script> It works fine in all browsers except ie(6,7,8) Code: Internet Explorer can not open website. Operation Aborted. I understand it is caused by the jquery autocomplete function loading before the page / DOM has fully loaded. I tried adding Defer="true" to the script however this doesn't seem to work. Could someone please tell me what i must add to the script so that it loads after the dom has fully loaded? Thanks guys George guys help pls.. i need to pass the data in the textfields from the left frame to the textfields in the right frame of my frameset. (ex: dslnum of frame1 will be pass to txtDSLTN of frame2) frame1: http://www.mediafire.com/?hge1ws29mdhmu7e frame2: http://www.mediafire.com/?k83cb64wbpskw97 thanks in advance! I have a web page with two frames, frame1 and frame2. I am trying to get the body tag of frame2 from frame1. I have declared two variables in javascript in frame1: var mainFrameDoc = parent.frame2.document; var mainFrameBody = mainFrameDoc.body; When I try to utilize the variable mainFrameBody I get an error stating that it is null or undefined. How can I get a handle to the body tag of frame2? I need to display a picture when it is clicked within various color mats and frames. Does anyone know the code for it? Thanks.
i have a simple frame that looks like this http://i307.photobucket.com/albums/n...aker/help2.jpg i have 3 pages (side.html, page1.html and page2.html) the above picture has side.html and page1.html loaded on default, what i want to do is whenever i click on the page 1 button, page1.html will load on the right side and when i click on page 2 button, page2.html will load i cant figure out what the code for this is and googling for the solution isn't getting me anywhere help please Hi, I will appreciate if someone could help me with this Case Problem. For some reason that I don't understand, it seems to be working in Firefox, but not IE. Well, most of it is working. The problem is to create a "Demo" which has three frames in rows. The first frame at the top is the title bar with "Submit Code", "show only code", "show only preview", and "show code and preview" buttons. The middle frame has 2 textarea boxes. The html code goes in the left box, and the css styles go in the right box. Once you enter any code in their respected boxes, and press "submit code", it should be rendered as a web page in the third frame below the boxes (which is just an empty document). I have attached a screenshot of how it should look like, and I am posting my entire code below. Everything is working except for the rendering of the web page in the third frame. When I click on submit, I get no errors, nothing happens. Any help or suggestions would be greatly appreciated. Thank you. Code: function showPreview(){ parent.document.getElementById("demo").rows="100,1,*"; } function showCode(){ parent.document.getElementById("demo").rows="100,*,1"; parent.frames[1].document.getElementById("inputhtml").style.height="300px"; parent.frames[2].document.getElementById("inputcss").style.height="300px"; } function showBoth(){ parent.document.getElementById("demo").rows="100,210,*"; parent.frames[1].document.getElementById("inputhtml").style.height="150px"; parent.frames[2].document.getElementById("inputcss").style.height="150px"; } function sendCode(){ var previewFrame=parent.frames[3]; var htmlCode=parent.frames[1].document.getElementById("inputhtml").value; var cssCode=parent.frames[2].document.getElementById("inputcss").value; previewFrame.document.write("<html><head><title></title>"); previewFrame.document.write("<style type='text/css'>"+cssCode+"</styles>"); previewFrame.document.write("</head>"); previewFrame.document.write("<body>"+htmlCode+"</body></html>"); //previewFrame.document.close(); } </script> </head> <body> <form name="control" id="control" action=""> <h2 id="demotitle">Creating Web Pages</h2> <p> <input type="button" value="Submit Code" onClick="sendCode()"/> <input type="button" value="Show Only Code" onClick="showCode()" /> <input type="button" value="Show Only Preview" onClick="showPreview()"/> <input type="button" value="Show Code and Preview" onClick="showBoth()"/> </p> </form> </body> </html> What's Up? OK, So I've been trying to add text to a <textarea> and text field tag inside of a frame via JavaScript, I did find a tutorial and using off-line html's it worked, But when I try to use a online frame, It doesn't work. OK, So one html opens two frames which are. Left.html Code: <HTML> <HEAD> <TITLE>JavaScript Example 13</TITLE> </HEAD> <BODY> <INPUT type="button" value="Button" onClick=""> </FORM> </BODY> </HTML> right.html Code: <form action="posting.php" method="post" name="post" onsubmit="return checkForm(this)"> <table width="100%" cellspacing="2" cellpadding="2" border="0"> <input class="post" type="text" value="" tabindex="2" style="width: 450px;" maxlength="60" size="45" name="subject"/> <textarea onkeyup="storeCaret(this);" onclick="storeCaret(this);" onselect="storeCaret(this);" class="post" tabindex="3" style="width: 450px;" cols="35" rows="15" name="message"/></textarea> <input type="submit" value="Submit" class="mainoption" name="post" tabindex="6" accesskey="s"/> Anyone Know What To Do? Thanks Bye. |