Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Open Links from one iframe in another iframe on index.php

General discussions related to php

Moderators: macek, egami, gesf

Open Links from one iframe in another iframe on index.php

Postby chris122380 » Mon Jul 23, 2012 9:09 am

Index.php has two iframes the first iframe (name=pages) is on the left side that opens the spec_list.php file I would like the links in that file to open in the second iframe (name=pdf) in Index.php. How do I get my pdf links queried in spec_list.php to open in index.php iframe name=pdf?

Index.php
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Main Page</title>

<link href="css/Untitled_1.css" rel="stylesheet" type="text/css" />
   <link rel="stylesheet" href="css/Untitled_1.css" type="text/css" media="screen, projection"/>
   <!--[if lte IE 7]>
        <link rel="stylesheet" type="text/css" href="css/ie.css" media="screen" />
    <![endif]-->
         
   <script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>   
   <script type="text/javascript" language="javascript" src="js/jquery.dropdownPlain.js"></script>

</head>

<body>

<div id="body">


   <div id="left">
      <ul class="dropdown">
            <li><a href="spec/Spec_list.php" target="pages">Specification</a></li>
            <li><a href="../aboutus.htm" target="pages">About Us</a></li>
            <li><a href="../contact.htm" target="pages">Contact Us</a></li>              
       </ul>
   
       <!-- test Div  <div id="pages" style='width: 400px; height:600px; background-color:gray; clear: both; overflow: auto; padding: auto 15px;'></div> -->
       <iframe name="pages" style="width: 399px; height:775px; clear:both; overflow:auto; padding: auto 15px;" border="0" frameborder="0"></iframe>
   
   </div>

   <div id="right">
   
   
   <!--<iframe src ="<?=$pdf;?>"></iframe> -->
   <iframe name="pdf" style="width: 617px; height:793px; clear:both; overflow:auto; " border="0" frameborder="0"></iframe>


   </div>
   
   <div id="bottom"> </div>


</div>




</body>

</html>


Please refer to my original post to see how my mysql query is being linked in my spec_list.php file. Hyperlink Variables in PHP?
chris122380
New php-forum User
New php-forum User
 
Posts: 30
Joined: Mon Jun 25, 2012 12:41 pm

Re: Open Links from one iframe in another iframe on index.ph

Postby johnj » Mon Jul 23, 2012 7:55 pm

Did you try the target attribute of the anchor tag(<a) and the id of the frame tag.

something like this e.g.

<iframe src="page.html" id="page">
<a href="somepage.pdf" target="page">
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Open Links from one iframe in another iframe on index.ph

Postby chris122380 » Mon Jul 23, 2012 8:15 pm

johnj wrote:Did you try the target attribute of the anchor tag(<a) and the id of the frame tag.

something like this e.g.

<iframe src="page.html" id="page">
<a href="somepage.pdf" target="page">


Yes but how is it to no the target or anchor when it's on a different page. I am trying to pull the target on the index.php from the spec_list.php page. My first iframe did work the way you recommend but that is because both the link and the iframe are in the index.php file. My secound iframe is in the index.php file but the link is in the spec_list.php
chris122380
New php-forum User
New php-forum User
 
Posts: 30
Joined: Mon Jun 25, 2012 12:41 pm

Re: Open Links from one iframe in another iframe on index.ph

Postby chris122380 » Thu Jul 26, 2012 1:36 pm

I have figured out how to pass the page to the iframe. Had to move the echo and the endwhile to the body of the html. Like so,
Code: Select all
<body>
<a href="spec/<?php echo $_SESSION['spec']; ?>.pdf" target="pdf"> <?php echo $_SESSION['spec'],'&nbsp;',$_SESSION['discription'], '<br />'; ?>   </a>
<?php endwhile; ?>
</body>


Now I am trying to figure out how to clear the iframe when clicking on a link that doesn't use it.
chris122380
New php-forum User
New php-forum User
 
Posts: 30
Joined: Mon Jun 25, 2012 12:41 pm


Return to PHP General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.