Showing posts with label ajax. Show all posts
Showing posts with label ajax. Show all posts

Wednesday, August 29, 2007

Google reader, an ajax beauty.

If you are a person who uses google reader, you might have noticed this, especially if you work in javascript / ajax. When you start to read a particular feed, it would look as if all the posts are loaded. Actually not. Google loads the bottom parts only when you move your mouse wheels or when you move down the page with your keyboard keys. beautiful isn't? Really a great device to keep the response time low and give an good user experience. Wow google!

Did you find more beauties? do comment!

Friday, July 27, 2007

show / hide using javascript

<html>
<head>

<script language="javascript">
var ids = new Array('one','two');

function hideElement(id)
{
if(document.getElementById)
{
document.getElementById(id).style.display='none';
}
}

function showElement(id)
{
if(document.getElementById)
{
document.getElementById(id).style.display='block';
}
}

function hideAll()
{
for(var i=0;i<ids.length;i++)
{
if(document.getElementById)
{
hideElement(ids[i]);
}
}
}

function switchId(id)
{
hideAll();
showElement(id);
}

</script>

</head>

<body>


<div id='one' style="display:block">
SHOWING <BR>
<a href="javascript:switchId('two');">show another</a>
</div>

<div id='two' style="display:none">
SHOWING NEXT ... <BR><a href="javascript:switchId('one');">cancel</a>
</div>

</body>
</html>