Jump to content

Refresh Some Items On The Page


Recommended Posts

hiya all another little problem again :),when i click on my links to go to say home page or login, it reloads the hole page, and that isnt necesery, is there any way to make my links only refresh the main body of the page and leave the header and my side links where they are? i hope i explianed my self.PS: i know this can be done with frames but im trying not to use them :) they mess my page up :).thanx in advance.

Link to post
Share on other sites

Hi Scorpion :)You should not use Ajax for the sake of saying you have Ajax on your site. You can just as easily use regular JavaScript to achieve this same effect. I am curious why you posted this in the CSS forum as CSS is just used for positioning and styling elements. HTML would have been a more appropriate starting forum for this thread.

Link to post
Share on other sites
Hi Scorpion :)You should not use Ajax for the sake of saying you have Ajax on your site. You can just as easily use regular JavaScript to achieve this same effect. I am curious why you posted this in the CSS forum as CSS is just used for positioning and styling elements. HTML would have been a more appropriate starting forum for this thread.
i really like that avatar! hahaha.
Link to post
Share on other sites

hiya. I'm only a n00b, but I'll throw in my 2 cents on this one.I'm trying to do a similar thing, so that menu items don't load a new page, they just load new content into page divs. It's pretty easy to do using java script:

<script type="text/javascript">function changeSection(content) {  xmlDoc.async=false;  xmlDoc.load(content + ".xml")  result = xmlDoc.getElementsByTagName("CONTENT")[0].childNodes[0].nodeValue;  document.getElementById("content").innerHTML = "<div class='content'><p class='wrap'>" + result + "</p></div>";}</script>

<div class="left">	<p class ="table" onclick="changeSection('welcome')">welcome</p>	<p class ="table" onclick="changeSection('news')">news</p>  <p class ="table" onclick="changeSection('literature')">literature</p>.......</div>

The document.getElementById("content") part in the first section finds <div class="content"> and changes the content depending on the CONTENT element of a .xml file with a name corresponding to the menu item clicked on. The difficulty is then styling the output. So far, I've just got the output in one class of <p> tags, which doesn't do anything fancy, but if you wanted to have links in the text or special fonts, you'd have to create a new element in the xml file and then positioning it would be, well, hard. So it might not be the ideal solution unless your output is to be fairly consistent and not have a lot of special formatting. The advantages are that it's instant and looks really clean, since there isn't any page loading time or whatever. Something to think about, anyway...

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...