Saturday, September 17, 2016

Disable mouse right-click





<script language="JavaScript" Type="text/javascript">
<!--
function popupMsg(theMsg) {
alert(theMsg);
}
//-->
</script>

Change background color depending on time of day

<script type="text/javascript">
var now = new Date();
var hours = now.getHours();

//Keep in code - Written by Computerhope.com
//Place this script in your HTML heading section

document.write('It\'s now: ', hours, '<br><br>');
document.bgColor="#CC9900";

//18-19 night
if (hours > 17 && hours < 20){
document.write ('<body style="background-color: orange">');
}
//20-21 night
else if (hours > 19 && hours < 22){
document.write ('<body style="background-color: orangered">');
}
//22-4 night
else if (hours > 21 || hours < 5){
document.write ('<body style="background-color: #C0C0C0;">');
}
//9-17 day
else if (hours > 8 && hours < 18){
document.write ('<body style="background-color: #616D7E">');
}
//7-8 day
else if (hours > 6 && hours < 9){
document.write ('<body style="background-color: skyblue">');}
//5-6 day
else if (hours > 4 && hours < 7){
document.write ('<body style="background-color: steelblue">');
}
else {
document.write ('<body style="background-color: white">');
}
</script>

Create a random website background color every five seconds

<script type="text/javascript">
function setbackground()
{
window.setTimeout( "setbackground()", 5000); // 5000 milliseconds delay

var index = Math.round(Math.random() * 9);

var ColorValue = "FFFFFF"; // default color - white (index = 0)

if(index == 1)
ColorValue = "FFCCCC"; //peach
if(index == 2)
ColorValue = "CCAFFF"; //violet
if(index == 3)
ColorValue = "A6BEFF"; //lt blue
if(index == 4)
ColorValue = "99FFFF"; //cyan
if(index == 5)
ColorValue = "D5CCBB"; //tan
if(index == 6)
ColorValue = "99FF99"; //lt green
if(index == 7)
ColorValue = "FFFF99"; //lt yellow
if(index == 8)
ColorValue = "FFCC99"; //lt orange
if(index == 9)
ColorValue = "CCCCCC"; //lt grey

document.getElementsByTagName("body")[0].style.backgroundColor = "#" + ColorValue;

}
</script>
<body onload="setbackground();">

Tuesday, November 10, 2015

Make HTML5 Elements Work in Old IE

(function() {
    if (! /*@cc_on!@*/ 0) return;
    var e = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,
dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,
output,progress,section,time,video".split(','),
        i = e.length;
    while (i--) {
        document.createElement(e[i])
    }
})()

Hotlink Script:
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

Detect Internet Explorer

<script type="text/javascript">
    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
//test for MSIE x.x;
        var ieversion = new Number(RegExp.$1)
// capture x.x portion and store as a number
        if (ieversion >= 8)
            document.write("You're using IE8 or above")
        else if (ieversion >= 7)
            document.write("You're using IE7.x")
        else if (ieversion >= 6)
            document.write("You're using IE6.x")
        else if (ieversion >= 5)
            document.write("You're using IE5.x")
    } else
        document.write("n/a")
</script>

Detect Javascript On/Off, With Notification

<script type="text/javascript"> document.write("Welcome, you have Javascript on.") </script> <noscript>JavaScript is off. Please enable to view full site.</noscript>

If JavaScript is on the user gets a welcome message. If off, the user is instructed to turn it on.

Wednesday, February 20, 2013

Watch ASCII Star Wars in Windows XP, Vista, 7 and 8

Every one of us has watched Star Wars on television, computer or in a theater. It is the same movie with aliens fighting each other for galaxies and such stuff. There is nothing new in it. But wait, have you watched an ASCII (American Standard Code for Information Interchange) version of Star Wars and that too in Windows using telnet? A word mostly linked with computer wizards. Well if you have not, then you must do it now!

There is a complete copy of Star Wars done entirely in ASCII characters that you can watch in the Windows operating system (or any OS that supports telnet). The only thing required to watch it is an internet connection; speed does not matter.

A Picture showing Star Wars in command prompt

To watch it on Windows XP, Mac OS X and Linux
  1. Go to Start, Run. (Only for Windows users)
  2. Now type "telnet towel.blinkenlights.nl" without the quotes and press Enter. Users of Mac OS X and Linux can directly execute this code in the terminal window.

On Windows 8, Windows 7 and Windows Vista

Telnet is turned off by default in the latest versions of Windows. So, in order to watch star wars, you must first enable telnet by going to Control Panel › Programs › Turn Windows Feature On or Off and ticking both the telnet check boxes. After doing that, follow the steps given below:-
  1. Go to Start, Search in Windows Vista and Windows 7. On Windows 8, open the main Start page.
  2. Type telnet and press Enter.
  3. In the following command prompt window, type "o" without quotes and press Enter.
  4. Now type "towel.blinkenlights.nl" without the quotes and press Enter.
If you do not need telnet anymore, you can turn it off.

 

How to Put Google Adsense Below Post Title in Blogger?

Adsense is used by  majority  of expert bloggers for their website monetization because it is a cookie based contextual advertising syste...