Even Waterstones …
Posted in JavaScript, Rambles on Nov 18th, 2008 No Comments »
This, from the UK’s leading high street bookseller. You’d expect them to get it right, wouldn’t you? It should be “Waterstones.com has shipped your order.”
Posted in JavaScript, Rambles on Nov 18th, 2008 No Comments »
This, from the UK’s leading high street bookseller. You’d expect them to get it right, wouldn’t you? It should be “Waterstones.com has shipped your order.”
Posted in JavaScript, Rambles on Jul 21st, 2008 No Comments »
This movie has had rave reviews all over the place, but the one thing all those reviews fail to mention is that the film is bloody awful. It’s a disappointing triumph of style over substance. The visuals are nothing short of stunning - almost real in their detail - but the plot is [...]
Posted in JavaScript, Rambles on Jun 27th, 2008 No Comments »
The wine is good but, like all fast food, the KFC never lives up to the picture. Zinger Tower Burger. “Tower”, my arse. It’s crap, but after watching a bunch of grown-ups playing rounders for a couple of hours, it’s just about tolerable.
Posted in JavaScript on May 17th, 2005 Comments Off
To use these, just call LTrim(), RTrim(), or Trim() with the string you want trimmed.
<script type=”text/javascript”>
<!–
function LTrim(trimInputString)
{
while(trimInputString.charAt(0)==” “)
trimInputString=trimInputString.substring(1,trimInputString.length);
return (trimInputString);
}
function RTrim(trimInputString)
{
while(trimInputString.charAt(trimInputString.length-1)==” “)
trimInputString=trimInputString.substring(0,trimInputString.length-1);
return (trimInputString);
}
function Trim(trimInputString)
{
while(trimInputString.charAt(0)==” “)
trimInputString=trimInputString.substring(1,trimInputString.length);
while(trimInputString.charAt(trimInputString.length-1)==” “)
trimInputString=trimInputString.substring(0,trimInputString.length-1);
return (trimInputString);
}
//–>
</script>
Posted in JavaScript on May 17th, 2005 Comments Off
To show the dates for Today - x days, set the value of x accordingly.
<script type=”text/javascript”>
<!–
DateToday = new Date();
x=7;
for (y=0; y<x; y++)
{
MyDate = new Date(Date.UTC(parseInt( _
DateToday.getYear()), _
parseInt(DateToday.getMonth()), _
parseInt(DateToday.getDate()))- _
(60*60*24*1000*y));
MyDateString=MyDate.getDate() + ‘.’ _
+ parseInt(MyDate.getMonth()+1) _
+ ‘.’ + MyDate.getYear();
document.write (MyDateString + “<br>”);
}
//–>
</script>
Posted in JavaScript on May 17th, 2005 Comments Off
If you want to check whether a particular value is in an array, call this function with something like this.
if (isInArray(MyValue, MyArray))
<script type=”text/javascript”>
<!–
function isInArray(needle, arrayHaystack)
{
for (x=0; x < arrayHaystack.length; x++)
if (arrayHaystack[x] == needle)
return true;
return false;
}
–>
</script>
Posted in JavaScript on May 17th, 2005 Comments Off
To use this, call GetNVP(string NVPString, string NVPid) with the input NVP string and the name of the value you want to retrieve.
<script type=”text/javascript”>
<!–
function GetNVP(NVPString,NVPid)
{
var NVPFound=false;
var NVPArray=new Array();
var NVPList=NVPString.split(’&’);
for (x=0; x<NVPList.length; x++)
{
NVPData=NVPList[x].split(’=’);
NVPArray[NVPData[0>=NVPData[1];
}
for (var LocalID in NVPArray)
if(NVPid==LocalID)
NVPFound=true;
if (NVPFound)
return (NVPArray[NVPid]);
else
return (’Name not found’);
}
–>
</script>
Posted in JavaScript on May 17th, 2005 Comments Off
To use this, just call CountDays() with two properly formatted date values.
<script type=”text/javascript”>
<!–
function CountDays(StartDate,EndDate)
{
var StartMS=Date.parse(new Date(StartDate));
var DateMS=Date.parse((EndDate));
return parseInt(DateMS-StartMS)/86400000;
}
var StartDate=’May 01, 2001 00:00:00′;
var EndDate=’May 17, 2001 00:00:00′;
document.write (CountDays(StartDate,EndDate));
//–>
</script>
Posted in JavaScript on May 17th, 2005 Comments Off
Flashing text is crap. Don’t do it.
This code needs a <div> to contain the text you want to flash, and is called in the ‘onLoad’ event of the <body> tag with something like <body onLoad=”Blink(’LayerName’);”>
<script type=”text/javascript”>
<!–
function Blink(BlinkID)
{
BlinkLayer = document.getElementById(BlinkID);
if (BlinkLayer.style.color==\’#880000\’ || BlinkLayer.style.color==\’rgb(136, 0, 0)\’ || BlinkLayer.style.color==\’rgb(136,0,0)\’)
BlinkLayer.style.color=\’#000088\’;
else
BlinkLayer.style.color=\’#880000\’;
setTimeout(\’Blink(\\’\’ + BlinkID + \’\\’)\’,500);
}–>
</script>