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.
jeavonatorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
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

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

Will this code help with this?
0
hieloCommented:
>>i actually have about 16 php includes
Well, you just have to think outside the box. Intead of doing 16 calls, make ONE call to say "includer.php".

Then in includer.php you do your 16 includes at once:
includer.php
<?php
include("file1.php");
...
include("file16.php");
?>

But to answer your question, you can include however many files you want into however many divs you want. It is not limited to a single inclusion.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JScript

From novice to tech pro — start learning today.