Scenario:
Two tables stacked on top of one another.
The first table is a menu:
picture text
the second table underneath
will display an image file or text file..
Is there a way to code this?
Thanks
Scenario:
Two tables stacked on top of one another.
The first table is a menu:
picture text
the second table underneath
will display an image file or text file..
Is there a way to code this?
Thanks
Yes,
put the table on DIV, with style=visibility:hidden one, show the other, and swap when onClick(). It's css.
But it's not a standard and may work on ie but not on mozilla, yes with konqueror but not with netscape... and so on...
if you don't care look this:
<div id="aname" style="position:absolute; left:-304px; top:41px; z-index:5; visibility: hidden; background-color: #3C6487;">
<img src="grafica/dot.gif" hspace="5">
</div>
<script>
function sLayer(n)
{
if (!document.getElementById) return;
x=document.getElementById(n);
x.style.visibility='visible';
}
</script>
<p onclick=sLayer('aname')>show text</p>
Now, the table is in an include file and being called into the html..
will this still work?
I think it will because the browser only sees the html that the php file writes, am I correct?
Since the browser-compatibility is an issue:
What if I simply wrote a javascript telling it to
write out two different php include statements..
one, the initial include that will be the default (the image)
the second, the include that contains the text
and then another javascript onClick function that will
switch the two includes depending on which link you choose?
Not.
The PHP is a SERVER-SIDE language, where JAVASCRIPT is a CLIENT-SIDE.
An event on CLIENT must be sent at SERVER and another page loaded. If you want only switch beetween two tables and not load another page, you must load both and show alternatively.
You can use this:
<div id="textpart" style="position:absolute; left:-304px; top:41px; z-index:5; visibility: visible; background-color: #3C6487;">
<?include("mytext")?>
</div>
<div id="imgpart" style="position:absolute; left:-304px; top:41px; z-index:5; visibility: hidden; background-color: #3C6487;">
<?include("myimg")?>
</div>
or load on click
if($targ="text"){
<?include("mytext")?>
} else {
<?include("myimg")?>
}