SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 38 of 38

Thread: How do i link?

  1. #26
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by jemz View Post
    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.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  2. #27
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,158
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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

    Code:
    <!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>

  3. #28
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by jemz View Post
    can you please help me on the load statement.i think i am lost
    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:

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

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

    Code javascript:
    $("#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.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #29
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,158
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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);

  5. #30
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by jemz View Post
    you mean this
    indeed
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #31
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,158
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    sorry i was disconnected

  7. #32
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,158
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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);

  8. #33
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by jemz View Post
    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.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  9. #34
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,158
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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?

  10. #35
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,158
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    still there???

  11. #36
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by jemz View Post
    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?
    It's the same effect, except that all of the content is stored within the page, instead of in separate files.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  12. #37
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by jemz View Post
    still there???
    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.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  13. #38
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,158
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •