2

I'm having a problem on how will I target, here's the scenario, whenever I click the links Home, or food or resort etc. the contents of it should be outputted on the display below. What always happen is that when I click those links It always goes to a new tab. What I wanted is that it should display on the same page and on a given div. Please help me, I've been trying to search the internet but different results are coming up.

Here are my links

<div id = "panel">
    <p>
        <a href = "home.html" target = "display">
            <font color ="white">Home</font
        </a>
        <a href = "resort.html" target = "display">
            <font color ="white">Resort</font>
        </a> 
        <a href = "hotel.html" target = "display">
            <font color = "white">Hotel</font>
        </a> 
        <a href = "food.html" target = "display">
            <font color ="white">Food</font
        </a> 
        <a href = "rates.html" target = "display">
            <font color="white">Rates</font>
        </a> 
        <a href="reservation.html"target="display
            <font color="white">Reservation</font>
        </a> 
        <a href = "contact.html" target = "display">
            <font color = "white">ContactUs</font>
        </a>
    </p>
</div>

This is where the content should be put in

<div id="display">
    <iframe name="display"></iframe>
</div>
Ramiz Wachtler
  • 5,623
  • 2
  • 28
  • 33

3 Answers3

0

If I understand the question--and I really don't--I think you're problem is pretty easy to fix. Just change this:

<name = "display">

To:

<iframe name="display">

I'm assuming you want to load those links inside an iframe, yes? Otherwise what you want to do will require javascript. But again, I'm not sure I understand.

There is no <name> tag in HTML, but there is a name attribute

Edit to explain iframes:

iframes load one web page B inside of webpage A, but the two are still separate pages. The "box" is probably the border of the iframe itself. The scrollbar appears when the content of webpage B is too large for the iframe to display everything at once. To get rid of the scrollbar, you can either make the iframe larger or make the content of webpage B smaller.

Making an iframe larger is no different than making any other element larger: just change it's CSS.

crowhill
  • 2,398
  • 3
  • 26
  • 55
0

I have tried this. Use this code <JsFiddle Link> :

At first load the jQuery:at the top of the code

<script src="https://code.jquery.com/jquery-1.10.2.js"></script>

Then add this jQuery code at the bottom of the file. In this code you will just check when an anchor tag is clicked and then return false which will prevent the anchor tag click submission. As well as load function will load the desired file of the "href" attribute.

<script>
$("a").on("click", function(){
//alert($(this).attr("href"));  
$( "#display" ).load( $(this).attr("href") );
return false;
});
</script>

NB: If you are running this in local server there is no problem. You also can load .php file in it. But if you are running it in Windows explorer or linux file system then open it in firebox.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Muhammad Ashikuzzaman
  • 3,075
  • 6
  • 29
  • 53
-2

yes crowhill is right. i think you want to have a single page website. then you have to write all the contents in a single html page with different divs for different contents which you want to display using the links and use the id of the divs in the href part of your tag (i.e. ).

i think this will clear your query.

https://www.freshdesignweb.com/free-one-page-wordpress-themes/

Batman
  • 480
  • 2
  • 8