May
15
2008

Javascript onfocus-onblur, show-hide table-div

For an example, visit SecretTweet.com and click in the textbox up top--the only textbox on the whole page. The captcha, tags field, language field, and submit button all are hidden until needed by the user.

<html>
<head>
<script type="text/JavaScript">
<!--
function showthetable(theTable)
{
      if (document.getElementById(theTable).style.display == 'none')
      {
            document.getElementById(theTable).style.display = 'block';
      }
}
//-->
</script>
</head>
 
<body>
<textarea name="whatever" cols="55" rows="2" onfocus="showthetable('TABLENAME');return true;"></textarea>
 
<div class="options">
<table border="0" cellpadding="0" cellspacing="0">
<tr id="TABLENAME" style="display: none;">
<td>
Hidden content until onfocus!  Hooray!
  </td>
</table>
</div>
 
Written by Kevin in: Javascript, WebDev |

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes