Search
Sponsors

Title bar clock

September 24th, 2009
   1:  <!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
   2:   
   3:  <HEAD>
   4:  <SCRIPT LANGUAGE="JavaScript">
   5:  <!-- Original: Massimo Giari (motore@iol.it) -->
   6:  <! >
   7:  <! >
   8:  <!-- Begin
   9:  var clocktext, timeday;
  10:  var pagetitle = document.title;
  11:  function scroll() {
  12:  today = new Date();
  13:  sec = today.getSeconds();
  14:  hr = today.getHours();
  15:  min = today.getMinutes();
  16:  // 12 Hour clock fix by Michael Mann (pres@manninc.com)
  17:  if (hr < 12) { timeday = " AM"; }
  18:  else { timeday = " PM"; }
  19:  if (hr > 12) hr = hr - 12;
  20:  if (hr <= 9) hr = "0" + hr;
  21:  if (min <= 9) min = "0" + min;
  22:  if (sec <= 9) sec = "0" + sec;
  23:  var clocktext = " - " + hr + ":" + min + ":" + sec + timeday;
  24:  clocktimer = setTimeout("scroll()", 1000);
  25:  document.title = pagetitle + clocktext;
  26:  }
  27:  if (document.all) scroll();
  28:  // End -->
  29:  </script>

Status Bar Clock

September 24th, 2009
   1:  <!-- STEP ONE: Put this code into the HEAD of your HTML document --> 
   2:   
   3:  <HEAD>
   4:  <SCRIPT LANGUAGE="JavaScript">
   5:  <!-- Original: Francis Woodhouse (francis@contessa.u-net.com) -->
   6:  <! >
   7:  <! >
   8:  <!-- Begin
   9:  function runClock() {
  10:  theTime = window.setTimeout("runClock()", 1000);
  11:  var today = new Date();
  12:  var display= today.toLocaleString();
  13:  status=display;
  14:  }
  15:  // End -->
  16:  </SCRIPT>
  17:   
  18:  <!-- STEP TWO: Put this code onLoad event handler in the BODY tag -->
  19:   
  20:  <body onLoad="runClock()">

Change case in a text box

March 4th, 2009

2 examples handy for when a user enters data on a form

<div align=”center”>
<form name=lowerexample”>
<input type=”text” name=”caps” size=”40″
value=”" onChange=”javascript:this.value=this.value.toLowerCase();”>
<br>
<input type=”button” value=”convert”>
</form>
</div>
<div align=”center”>
<form name=”upperexample”>
<input type=”text” name=”caps” size=”40″
value=”" onChange=”javascript:this.value=this.value.toUpperCase();”>
<br>
<input type=”button” value=”convert”>
</form>
</div>

Alert on button press

February 23rd, 2009

This simply pops up an alert box when you push a button

<form enctype=”application/x-www-form-urlencoded”>
<input type=”button” value=”Click here to be alerted” /> onClick=’alert(”irritating things these arent they”)’>
</form>

Back and Forward buttons

February 23rd, 2009

<form>
  <input TYPE=”button” VALUE=”  BACK  ” onClick=”history.go(-1)”>
  <input TYPE=”button” VALUE=”FORWARD” onCLick=”history.go(1)”>
</form>

Translate