Jump to content

get site to load in iframe


brentmoeller

Recommended Posts

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>

 

 

FelonyGames.com-1299334410-U1.jpg

Link to comment
Share on other sites

 

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.

 

 

Link to comment
Share on other sites

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

FelonyGames.com-1299443612-U1.png

Link to comment
Share on other sites

 

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".

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.