Reply to Re: Load parts of a page as needed?

Your name:

Reply:


Posted by J.O. Aho on 01/15/07 12:20

CRON wrote:
> Hi!,
> Anyone know a way to save on loading times by only loading part of the
> page after a link is clicked? iframes is an obvious solution but it
> would be messy. Is it possible to change the content of a div when a
> link is clicked?

Yes, you can do that with help of javascript (even jscript works, but then you
lock out a good number of users)

--- javascript ---
function showdiv(id)
{
el = document.getElementById(id);
if (el.style.display == 'none') {
el.style.display = '';
el = document.getElementById('_' + id);
} else {
el.style.display = 'none';
el = document.getElementById('_' + id);
}
return false;
}
--- eof ---

--- the div ---
<div id="divID">Something here!</div>
--- eof ---

--- the link ---
<a href="" title="The Link" onclick="javascript:showdiv('divID');return
false;">The Link to show or hide div named divID</a>
--- eof ---

Should work on all javascript supporting browsers.

--

//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация