Bits and pieces of HTML that I find useful and don't want to have to remember later. -- AdamShand
See also: CascadingStyleSheets
Contents
Developement Tools
- Online Lynx viewer (check out your fancy pages in Lynx ... without Lynx)
- HTML/CSS validator site
Meta Tags
All meta tags need to go in the <head></head> section at the top of the page.
Auto-redirect to Another Page
Redirect from loaded page to www.spack.org after 5 seconds.
<meta http-equiv="refresh" content="5; URL=http://www.spack.org/">
Disable Microsoft Smarttags
This disables Microsoft's evil Smarttags which allow third party software to hyperlink words on your pages.
<meta name="MSSmartTagsPreventParsing" content="TRUE">
Java Script
onMouseover
This goes where ever you want it to.
<a href="/target/" class="body" target=_n onMouseover="return overlib('Over Link Text');" onMouseOut="return nd();">Link Text</a>
Initial Focus on a Form
You can use this make a form ready to type in when a page first loads.
<script language="javascript"> <!-- document.login.userName_pw.focus(); // --> </script>
Hide a Box on Click
I want to do this for my GallerySoftware theme, to make EXIF and IptcSpecification take up less space unless someone wants to see it. The below code is stolen from WikiPedia.
<!-- showhide.js -->
function showTocToggle(show,hide) {
if(document.getElementById) {
document.writeln('<span class=\'toctoggle\'>[<a href="javascript:toggleToc()" class="internal">' +
'<span id="showlink" style="display:none;">' + show + '</span>' +
'<span id="hidelink">' + hide + '</span>'
+ '</a>]</span>');
}
}
function toggleToc() {
var toc = document.getElementById('tocinside');
var showlink=document.getElementById('showlink');
var hidelink=document.getElementById('hidelink');
if(toc.style.display == 'none') {
toc.style.display = tocWas;
hidelink.style.display='';
showlink.style.display='none';
} else {
tocWas = toc.style.display;
toc.style.display = 'none';
hidelink.style.display='none';
showlink.style.display='';
}
}
<!-- showhide.html -->
<html>
<head>
<script type="text/javascript" src="showhide.js"></script>
</head>
<body>
<table border="0" id="toc">
<tr id="toctitle">
<td align="center">
<b>Table of contents</b>
<script type="text/javascript">
//<![CDATA[
showTocToggle("show","hide")
//]]>
</script>
</td>
</tr>
<tr id="tocinside">
<td>
<div class="tocline"><a href="#Early_life">1 Early life</a></div>
<div class="tocline"><a href="#Political_activity">2 Political activity</a></div>
<div class="tocline"><a href="#Arrest_and_imprisonment">3 Arrest and imprisonment</a></div>
</td>
</tr>
</table>
</body>
</html>