Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > PHP Programming
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 10-13-2009, 04:31 AM
  #1
dustin//
Novice (Level 1)
 
Join Date: Oct 2009
Posts: 4
iTrader: (0)
dustin// is an unknown quantity at this point
ajax or php to load new content into div?

a site i'm working on has a flash header, so i'm trying to avoid having to reload that every time you click within the navigation.

to accomplish this, i was planning on using ajax to load in the content in a div, since all the content to be loaded will be on the same server.

is there a way to do this and change the url so that i don't break the ability to bookmark? or is there possibly a better solution to my desire to not reload the header? or should i just make it reload?
dustin// is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-14-2009, 10:53 AM
  #2
Vege
Super Deity (Level 18)
 
Join Date: Sep 2004
Location: Finland
Posts: 3,410
iTrader: (0)
Vege is just really niceVege is just really niceVege is just really niceVege is just really nice
You don't need ajax, just javascript that swaps visibility of divs with onclick effect.
You can maintain the bookmarkability () with anchor tag that you can read with javascript then set the visibility of div with that information from anchor.
Vege is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-14-2009, 05:16 PM
  #3
Vege
Super Deity (Level 18)
 
Join Date: Sep 2004
Location: Finland
Posts: 3,410
iTrader: (0)
Vege is just really niceVege is just really niceVege is just really niceVege is just really nice
K, i was bored:
needs jquery http://jquery.com/

HTML Code:
<!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" xml:lang="fi">
	<head>
<script src="jquery.js" type="text/javascript" ></script>
<script>

$(document).ready(function()
{
  if(self.document.location.hash.substring(1))
  change(self.document.location.hash.substring(1));
  else
  change('first');
});

function change(refreshthis)
{

  if(self.document.location.hash.substring(1))
  {
    $(".divs").each(function() {
     if(this.id== refreshthis)
       this.style.display='block';	
     else
       this.style.display='none';

    });
  }
}

</script>

	</head>
	<body>
        <a onclick="change('first');" href="#first" >first</a>
        <a onclick="change('second');" href="#second">second</a>
        <a onclick="change('third');" href="#third">third</a>

        	<div id="first" class="divs" >a</div>
        	<div id="second" class="divs" >b</div>
        	<div id="third" class="divs">c</div>
<br />
<embed src="http://www.youtube.com/v/W-Q7RMpINVo&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>
	</body>
</html>

Last edited by Vege : 10-14-2009 at 05:24 PM.
Vege is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 09:26 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.