Link to home
Start Free TrialLog in
Avatar of srfc
srfc

asked on

PHP Div ID Update Div Content

OK....This is really doing my head in!!!

Right i have the following

<div id="menu"><a href="Link 2" onClick=document.getElementById('home').href="home.php"
 onmouseover="setOverImg('2','');" onmouseout="setOutImg('2','');" target=""><img src="buttons/button2up.png" border="0" id="button2" vspace="2" hspace="2">
</div>

I have the seperate Div i want to update which is

<div id="home" style="Z-INDEX: 2; POSITION: absolute; TOP: 5px; left: 260px;"><?php include("content.php"); ?></div>

I cannot get this div content to update to show the home.php, please can someone help me put this right as i'm really not understanding why it's not working!

Please can someone tell me how to do an example with the following

Image
Hyperlink
Button

Thanks again
Avatar of ncoo
ncoo

Your missmatching css and php.

PHP is run on the server and CSS/Javascript is run on the client (Firefox, IE).

When the following is sent to the user, the server has already run <?php include("content.php"); ?> so you can't change it.

<div id="home" style="Z-INDEX: 2; POSITION: absolute; TOP: 5px; left: 260px;"><?php include("content.php"); ?></div>

You can though do this to change the div.

<div id="menu"><a href="Link 2" onClick=document.getElementById('home').innerHTML="something else in the div"
 onmouseover="setOverImg('2','');" onmouseout="setOutImg('2','');" target=""><img src="buttons/button2up.png" border="0" id="button2" vspace="2" hspace="2">
</div>
Avatar of srfc

ASKER

i have previously changed it before with the onclick process where it has changed the page to another one i just deleted the code by accident!
i think instead of .innerhtml it was .href"page2.php"; or something
Avatar of srfc

ASKER

Seeing as no one has replied i worked it out my self and it works a treat
<?php include("Home.php")?> i used this with a link in my menu and the div updates
Could you give details as to how you fixed your problem, I can't figure out how to do this either, I've been searching for hours now. Show me some code? PLEASE?
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial