I am designing a site right now that I need to have links just display information in other frames. I am using the DIV format to make layers I guess and was wondering how I could make a link in on change the content of another. Is this possible? If so, how? I would greatly appreciate any help. -Tipsy-

Dani AI

Generated

Short answer: yes — without JavaScript there are two practical patterns for changing content in one area from links placed elsewhere: use an inline <iframe> (can sit inside a DIV) and target that iframe with named links, or render the changed area on the server and reload the page’s template with different content inserted. ’s Dynamic Page Updating example uses JS to swap DIVs in-place; since asked for no-JS alternatives, the following covers both iframe and server-side options plus important caveats.

Example — iframe inside a DIV (no JS):

<div id="panel">
  <iframe name="panelFrame" src="content1.html" style="width:100%;height:400px;border:0;"></iframe>
</div>

<nav>
  <a href="content1.html" target="panelFrame"><img src="btn1.png" alt="Content 1"></a>
  <a href="content2.html" target="panelFrame"><img src="btn2.png" alt="Content 2"></a>
</nav>

Notes: placing an iframe inside a DIV is valid HTML; links with a matching target load into that iframe only. If the named target does not exist the browser opens a new window with that name. Some sites send X-Frame-Options headers that prevent embedding — see the MDN iframe docs for details (iframe - MDN) and the anchor target behavior (a - MDN).

Example — server-side include (no partial reload):

<?php
$allowed = ['home','about','help'];
$section = 'home';
if (!empty($_GET['s']) && in_array($_GET['s'],$allowed)) {
  $section = $_GET['s'];
}
include __DIR__ . '/sections/' . $section . '.php';
?>

Links would be simple anchors like index.php?s=about. This reloads the whole page but avoids iframe limitations and is better for SEO; always whitelist filenames to prevent file-inclusion vulnerabilities (see PHP include).

Accessibility/UX cautions: iframes can hurt SEO and keyboard navigation unless properly labeled; a server-rendered approach is more robust for search and progressive enhancement. For the best user experience, consider enhancing the server/iframe approach later with JS if dynamic in-place updates and browser history control become desirable.

Recommended Answers

All 2 Replies

I have a page on Dynamic Page Updating where which of several DIVs is displayed in the same place on the page is determined by which of several links was last selected.

Is this what you are looking for?

This is close to what I am looking for except that I need to do this without the use of javascript and just by using custom buttons that i have designed for the site. Is there a way I can nest a frame inside of a DIV and just update that frame? When I put in a hyperlink and give it a target, what are my limits with that in HTML?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.