0

My html page is divided in to three columns using CSS and float. In the left hand column I want to put a selection of links ... how can I direct these links to open in the middle (main) float?

code is from https://www.w3schools.com/css/tryit.asp?filename=trycss_template2_float with the difference that I've separated the style sheet from the html using

<link rel="stylesheet" type="text/css" href="test.css">

to tie the two files together.

As to what I've tried ... nothing. The w3s link doesn't appear to have anything appropriate I could put in to the YYYY part of the link.

DarrenRhodes
  • 1,431
  • 2
  • 15
  • 29

2 Answers2

1

$(".links a").on("click", function (e) {
  e.preventDefault();
  $(".content #myIframe").attr("src", $(this).attr("href"));
});
div { width: 49%; display: inline-block; }
.content { border: 1px solid #ccc; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div class="links">
  <ul>
    <li><a href="http://exocraft.io">exocraft.io</a></li>
    <li><a href="https://slither.io">slither.io</a></li>
    <li><a href="https://www.bing.com">bing.com</a></li>
  </ul>
</div>
<div class="content">
  <iframe id="myIframe" src=""></iframe>
</div>
moatist
  • 198
  • 1
  • 13
0

do this

$(".links a").on("click", function (e) {
  e.preventDefault();
  $(".content #myIframe").attr("src", $(this).attr("href"));
});
div { width: 49%; display: inline-block; }
.content { border: 1px solid #ccc; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div class="links">
  <ul>
    <li><a href="https://www.google.com">google</a></li>
    <li><a href="https://www.yahoo.com">yahoo</a></li>
    <li><a href="https://www.microsoft.com">microsoft</a></li>
  </ul>
</div>
<div class="content">
  <iframe id="myIframe" src=""></iframe>
</div>
MajiD
  • 2,420
  • 1
  • 22
  • 32