FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

load file into div dynamically using html possible

 


mothmann
currently i am using a combination of javascript and html to load pages dynamically into a div section of my main page. the code uses an onClick that calls a javascript function that uses writeIn to embed a .swf as an object into a div.

Is it possible to do this without using the javascript?

Also, is it possible to do this and embed a .html or .txt file?

If you need examples of the code please just ask. Thanks in advance.
James007
If you don't mind reloading the page, you could use a little php like this:

Put this between div-tags:
Code:
<?php
if(isset($_GET['p'])) {
$p = $_GET['p'];

switch ($p) {
case "home":
include('home.txt');
break;

case "contact":
include('contact.txt');
break;

default:
include('home.txt');
break;
}

} else {
include('home.txt');
}
?>


Make your links to the different pages as follows:
Code:
<a href="?p=home">HOME</a>
<a href="?p=contact">CONTACT</a>


Of course you should rename your page from "page.html" to "page.php".

If you don't want to reload your page, you should use ajax again. (the big difficult javascript thing yes...)
mothmann
I was hoping it was possible with html and css with no other coding. I didn't think it was possible, but I figured it wouldn't hurt to ask around. i guess i could just place all the content in a div and hide it till something is pressed.

wait. why would i even use ajax when it would be possible with just normal javascript. 1 line of code with an on*
muzzz
AFAIK, meaningful content manipulation isn't possible without scripting. You could try taking a peek at the :before or :after pseudo-elements along with the content property. Probably won't work well, especially in any sort of cross-browser way, but it's all I can think of.

Spec: http://www.w3.org/TR/CSS21/generate.html
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.