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?
 
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:
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
 
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
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.