brentmoeller Posted March 5, 2011 Share Posted March 5, 2011 Illl show you the files and maybe someone can help me figure out whats going on. Lil more about the script When explore.php is opened it selects a random approved link out of the database and posts it within the iframe. Explore.php also calls random.php which has a nice little menubar. When the explore.php is originally clicked on everything works great a random site is selected and ran inside the iframe and the javascript menubar is loaded above the iframe. The issue is i cant get this to happen again. In the menu bar i have a hyperlink that loads <li><a href="http://localhost/Stumble/explore.php" rel="gotsubmenu[selected]">JavaScript Kit</a></li> But when i click this link it just opens the page behind the iframe instead of in the iframe like it does when the explore.php is originally loaded. So i guess i need a lil help figuring out how i can make the random approved site load in the iframe by clicking a hyper link located in the menubar Thanks for your time Random.php <?php /** * @author moeller * @copyright 2011 */ ?> <html> <head> <link rel="stylesheet" type="text/css" href="mouseovertabs.css" /> <script src="mouseovertabs.js" type="text/javascript"> /*********************************************** * Mouseover Tabs Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more ***********************************************/ </script> </head> <body> <div id="mytabsmenu" class="tabsmenuclass"> <ul> <li><a href="http://localhost/Stumble/explore.php" rel="gotsubmenu[selected]">JavaScript Kit</a></li> <li><a href="http://www.cssdrive.com" rel="gotsubmenu">CSS Drive</a></li> <li><a href="http://localhost/Stumble/explore.php">No Sub Menu</a></li> </ul> </div> <div id="mysubmenuarea" class="tabsmenucontentclass"> <!--1st link within submenu container should point to the external submenu contents file--> <a href="submenucontents.htm" style="visibility:hidden">Sub Menu contents</a> </div> <script type="text/javascript"> //mouseovertabsmenu.init("tabs_container_id", "submenu_container_id", "bool_hidecontentsmouseout") mouseovertabsmenu.init("mytabsmenu", "mysubmenuarea", true) </script> </body> </html> explore.php <?php /** * @author Brent Moeller * @copyright 2011 */ include ('functions.php'); db_connect(); $result = mysql_query("SELECT * FROM slinks where approval='1' ORDER BY RAND() LIMIT 1") or die(mysql_error()); ?> <html> <head> <title>DizzyUrl Discovery Engine</title> </head> <frameset rows="80,*" BORDERCOLOR="green" BORDER="3"> <frame src="random.php" name="surfbar" marginwidth="O" marginheight="0" NORESIZE SCROLLING="no" /> <frame src="<?php while ($row = mysql_fetch_array($result)){ print $row["url"];}?> " name="random" marginwidth="O" marginheight="0" noresize scrolling="auto" /> </frameset> <noframes> <body><p>This Browser does not support Frames.</p></body> </noframes> </html> Quote Link to comment Share on other sites More sharing options...
brentmoeller Posted March 5, 2011 Author Share Posted March 5, 2011 i TRIED a couple new snippets, but still no luck Quote Link to comment Share on other sites More sharing options...
brentmoeller Posted March 6, 2011 Author Share Posted March 6, 2011 Any ideas guys? Unfortunately this issue has put a delay on me finishing this script in a timely manner Quote Link to comment Share on other sites More sharing options...
Krash Posted March 6, 2011 Share Posted March 6, 2011 You have to name the iframe and target all the links to the iframe name. Quote Link to comment Share on other sites More sharing options...
brentmoeller Posted March 6, 2011 Author Share Posted March 6, 2011 hi thanks for the response could i get you to explain what your referring to in a deeper detail Quote Link to comment Share on other sites More sharing options...
Krash Posted March 6, 2011 Share Posted March 6, 2011 When you set up a frame or iframe, include a name parameter, <iframe name="fred".......>, and you target your links to that frame with <a href="url" target="fred"..........>. If you don't do that, the link will load into whichever frame the button's in. Same as naming a window in js - you have to tell the browser where you want the new page to load. Quote Link to comment Share on other sites More sharing options...
brentmoeller Posted March 6, 2011 Author Share Posted March 6, 2011 Ok great. i altered the code to <li><a href="http://localhost/Stumble/explore.php "target="random">No Sub Menu</a></li> so when the link is clicked unfortunately this promps a new window to open as seen in the photo. When i click on No sub menu link through the window that pops up it functions as it should. how do i go about keeping this from opening a new window ? thanks Quote Link to comment Share on other sites More sharing options...
Krash Posted March 7, 2011 Share Posted March 7, 2011 You have to name the frame in your frame code, like this - <iframe src="chathelp.htm" width="250px" height="560px" scrolling="auto" frameborder="12" name="random"></iframe> Then your link will direct the content to the proper frame - <li><a href="http://localhost/Stumble/explore.php" target="random">No Sub Menu</a></li> If you haven't named the frame, the link will open a new window called "random". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.