How do i link?

How do you expect a link to trigger the display of content on the page, as well as link to some other location? Are you wanting one link to perform different behaviour at different times?

I do apologize i could not get you,what i want to perform is that every time when i click a link in my menu and that link is calling the page1.php or page2.php
hre=“page1.php” or href=“page2.php”, this will load into the dive which id is content.

Ahh, well that’s very different. You can use jQuery’s .load() method for that.

by the way what is inside the div in your post #2?

div has 3 dotted,or what should i put in that dotted?

You can use jQuery’s .load() method for that.

Sounds like that will work now for me.hehehe.

by the ways in you post no#2 how does it behave as i have thought it will load to the div?but you’ve said now that i will use the .load method?

If you are planning to load the content from an external file, you don’t need anything in the content area to start with. You can just leave that content area empty.

If you are planning to load the content from an external file, you don’t need anything in the content area to start with. You can just leave that content area empty.

Can you please help me on the load statement.i think i am lost

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

  <head><title>Index</title>

	   <script type="text/javascript" src="jquery.js"></script>

	   <script type="text/javascript">
	
		$("div#menu").on("click","a",function(event)
		{
			  event.preventDefault();
			   $("div#menu a").each(a.attr("href"))
			   {
			      $("div#content").load($(this));
			   }
			});
		});
	</script>

  </head>
  <body>
       <div id="menu">	
	      <ul>
	            <li class="header">My menu</li>
		    <li><a href="page1.php"><span>Search name<span></a></li>
	            <li><a href="page2.php"><span>Search fname<span></a></li>
	           <li><a href="page3.php"><span>Search lname<span></a></li>

	     </ul>							
</div>	


<div id="content">


</div>

</body>

</html>

You don’t need that each method now, because you’re not needing to hide anything. The load method replaced the entire content area with what comes from the linked file.

So you would want to use something like this:


var file = $(this.href);
$("#content").load(file);

Or you could get rid of the variable and do something like this:


$("#content").load($(this.href));

Personally I prefer the first example, because it’s easier to at a glance, understand at what is going on there.

Personally I prefer the first example, because it’s easier to at a glance, understand at what is going on there.

you mean this

var file = $(this.href);
$(“Content”).load(file);

indeed

sorry i was disconnected

var file = $(this.href);
$(“Content”).load(file);

is this okay without putting the div?

var file = $(this.href);
i mean like this $(“div#content”).load(file);

Yes, that’s okay, but the div is a waste because the Content is specific enough to refer to the same item. If you like that keeping the div in there helps to remind you that it’s a div, then by all means keep it in there.

It’s working now…hehehehehe…thank you so much for helping me…by the ways in your post #2 is this also the same effect?

still there???

It’s the same effect, except that all of the content is stored within the page, instead of in separate files.

This is not a live chat. It’s an internet forum which doesn’t involve live conversations. Forums are less like telephone calls or text messaging, and more like sending emails.

This is not a live chat. It’s an internet forum which doesn’t involve live conversations. Forums are less like telephone calls or text messaging, and more like sending emails.

I do apologize…Thank you so much for helping me and for the idea that you share…more power to you always.