Link to home
Start Free TrialLog in
Avatar of jeavonator
jeavonator

asked on

changing the code in div tags using javascript

Hi guys,

I was hoping somone may know the answer to my problem.

I have 4 divs dividing up my site and inside, lets just call it div2 I have an imagemap. I am  looking for  some type of onclick javascript function which will replace the code of another div.... lets say div3, with a php include statement when the imagemap is clicked.

I hope somone has a working problem.
Avatar of hielo
hielo
Flag of Wallis and Futuna image

the code below should include the output of yourFile.php INTO div id="c" whenever you click on div id="b"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>hielo</title>
		<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
		<script language="JavaScript" type="text/javascript">
		$(function(){
			$('#b').bind('click',function(){ $('#c').load('yourFile.php'); });
		});
		</script>

	</head>
	<body>
		<div id="a"></div>	
		<div id="b"></div>	
		<div id="c"></div>	
		<div id="d"></div>	
	</body>
</html>

Open in new window

Avatar of jeavonator
jeavonator

ASKER

Thanks hielo
i actually have about 16 php includes i want to put into the changing div.

Will this code help with this?
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna 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