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.
Who is Participating?
hieloConnect With a Mentor Commented:
>>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:

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.
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"

<html xmlns="">
		<script type="text/javascript" src=""></script>
		<script language="JavaScript" type="text/javascript">
			$('#b').bind('click',function(){ $('#c').load('yourFile.php'); });

		<div id="a"></div>	
		<div id="b"></div>	
		<div id="c"></div>	
		<div id="d"></div>	

Open in new window

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?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.