Click to See Complete Forum and Search --> : Scrolling Div's
Here is my code:
<div style="border : solid 2px #ff0000; background : #000000; color : #ffffff; padding : 4px; width : 200px; height : 50px; overflow : auto; ">
1<br />
2<br />
3<br />
4<br />
5<br />
6<br />
7<br />
8<br />
9<br />
10<br />
</div>
It works fine like that but I was wundering if it was possible to have another page in the scrolling div instead of just text. I was told once that you could use a scrolling div and it would work just like an Iframe. I'm just not sure how to make it so there is an external file you scroll inside the div? Please help. Thanks. :D
Da Warriah
08-04-2003, 08:45 PM
well if your file is .php, then just do something like this:
<div style="border : solid 2px #ff0000; background : #000000; color : #ffffff; padding : 4px; width : 200px; height : 50px; overflow : auto; ">
<?php include "externalfile.php"; ?>
</div>
that should do it...:D
One more thing! How do I get a link to open up in that div? I have some links on my page that used to have a target to open links in the Iframe but now they don't work any more after I changed my Iframe to a div so how could I set it up so when the user clicks a link it will replace the page thats in the div with the page that the link goes to? So basicly it's the same idea as the Iframe but in a div! Thanks. :)
Take a look at http://www.infinitypages.com/research/divinclude.php
Well I spent the better part of last night and this morning trying to figure out how to make this script (which I found at the link you gave me) work with my page:
<div id="mydiv" style="border:1px solid">
<?PHP
if (!isset($_GET["file"])) {
$include = "divinclude/default.php";
}
else {
$include = $_GET["file"];
}
include("$include");
?>
Could you help me out here? I need it so links on my main page will open up in the div. Basicly it's just acting like an Iframe but only it's really a Div! ;)
Da Warriah
08-05-2003, 10:17 AM
i dont think you want the quotes...try this instead:
include ($include);
or even simpler:
include $include;
Can you go here a tell me what I did wrong here?
http://kd7pyo.infinitypages.com/test/test/divinclude.php
Here is my code:
<div id="mydiv" style="border:1px solid"><br/><center>This is page one</center><br/></div>
<?PHP
if (!isset($_GET["file"])) {
$include = "divinclude.php";
}
else {
$include = $_GET["file"];
}
include("$include");
?>
<a href="divinclude.php">Show default page</a> | <a href="divinclude.php?file=home.php">Show include one</a> | <a href="divinclude.php?file=index.php">Show include two</a>
</div>
I'm having lots of troble with this so could you fix the code and then repost it please. I'll even take a different code. All I'm tryin to do is to get my links to open up in my div. Thanks.
Da Warriah
08-05-2003, 12:16 PM
try something like this:
<div id="mydiv" style="border:1px solid"><br/><center>This is page one</center><br/></div>
<?PHP
if (isset($_GET["file"])) {
$include = $_GET["file"];
}
include "$include.php";
?>
<a href="divinclude.php">Show default page</a> | <a href="divinclude.php?file=home">Show include one</a> | <a href="divinclude.php?file=index">Show include two</a>
</div>
it appears that this code is on "divinclude.php"...in that case, you dont want it including itself when the $file variable isnt set...so that should work out a bit better for you...
I don't think my idea is getting accrossed exactally as I planed it. Maybe I can show you better than I can tell you. Go here and look at the page and the source for the page.
http://kd7pyo.infinitypages.com/test/test/
You will notice there is a white part where my main content goes. That part used to be an Iframe but now I changed it to a Div. It is a scrolling div. If you look above the white main content area you will see some links. I need the links to open up in the div. They used to open up in the Iframe but now I'm using a div so I need to do it differently. The only thing I have been trying to do is get it so those links open up in the main content area. Hope I explained it better now. Thanks. :)
Dragons_Bane
08-07-2003, 02:54 PM
I went to your links, and Its opening the sub pages in a new window... now i'm using Mozilla 1.4 browser, not IE, you may want to make sure that it works in both since I know personally alot of people that use Netscape/Mozilla (same thing really) and not IE.