How to show today’s Date on your website
->
Here is how you can show today's Date on your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <!-- ONE STEP TO INSTALL MONTHLY: DAY HIGHLIGHTED: 1. Put the code into the BODY of your HTML document --> <!-- STEP ONE: Copy this code into the HEAD your HTML document --> <html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 6.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> </head> <body> <center> <script LANGUAGE="JavaScript"> <!-- Begin monthnames = new Array( "January", "Februrary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Decemeber"); var linkcount=0; function addlink(month, day, href) { var entry = new Array(3); entry[0] = month; entry[1] = day; entry[2] = href; this[linkcount++] = entry; } Array.prototype.addlink = addlink; linkdays = new Array(); monthdays = new Array(12); monthdays[0]=31; monthdays[1]=28; monthdays[2]=31; monthdays[3]=30; monthdays[4]=31; monthdays[5]=30; monthdays[6]=31; monthdays[7]=31; monthdays[8]=30; monthdays[9]=31; monthdays[10]=30; monthdays[11]=31; todayDate=new Date(); thisday=todayDate.getDay(); thismonth=todayDate.getMonth(); thisdate=todayDate.getDate(); thisyear=todayDate.getYear(); thisyear = thisyear % 100; thisyear = ((thisyear < 50) ? (2000 + thisyear) : (1900 + thisyear)); if (((thisyear % 4 == 0) && !(thisyear % 100 == 0)) ||(thisyear % 400 == 0)) monthdays[1]++; startspaces=thisdate; while (startspaces > 7) startspaces-=7; startspaces = thisday - startspaces + 1; if (startspaces < 0) startspaces+=7; document.write("<table border=2 bgcolor=white "); document.write("bordercolor=black><font color=black>"); document.write("<tr><td colspan=7><center><strong>" + monthnames[thismonth] + " " + thisyear + "</strong></center></font></td></tr>"); document.write("<tr>"); document.write("<td align=center>Su</td>"); document.write("<td align=center>M</td>"); document.write("<td align=center>Tu</td>"); document.write("<td align=center>W</td>"); document.write("<td align=center>Th</td>"); document.write("<td align=center>F</td>"); document.write("<td align=center>Sa</td>"); document.write("</tr>"); document.write("<tr>"); for (s=0;s<startspaces;s++) { document.write("<td> </td>"); } count=1; while (count <= monthdays[thismonth]) { for (b = startspaces;b<7;b++) { linktrue=false; document.write("<td>"); for (c=0;c<linkdays.length;c++) { if (linkdays != null) { if ((linkdays[0]==thismonth + 1) && (linkdays[1]==count)) { document.write("<a href=\"" + linkdays[2] + "\">"); linktrue=true; } } } if (count==thisdate) { document.write("<font color='FF0000'><strong>"); } if (count <= monthdays[thismonth]) { document.write(count); } else { document.write(" "); } if (count==thisdate) { document.write("</strong></font>"); } if (linktrue) document.write("</a>"); document.write("</td>"); count++; } document.write("</tr>"); document.write("<tr>"); startspaces=0; } document.write("</table></p>"); // End --> </script> </center> <!-- Script Size: 2.98 KB --> </body> </html> <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
How to put a clock on your website
->
Here is how you can put a clock on your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <SCRIPT LANGUAGE="JavaScript"> var timerID = null; var timerRunning = false; function stopclock () { if(timerRunning) clearTimeout(timerID); timerRunning = false; } function showtime () { var now = new Date(); var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds() var timeValue = "" + ((hours >12) ? hours -12 :hours) timeValue += ((minutes < 10) ? ":0" : ":") + minutes timeValue += ((seconds < 10) ? ":0" : ":") + seconds timeValue += (hours >= 12) ? " P.M." : " A.M." document.clock.face.value = timeValue; // you could replace the above with this // and have a clock on the status bar: // window.status = timeValue; timerID = setTimeout("showtime()",1000); timerRunning = true; } function startclock () { // Make sure the clock is stopped stopclock(); showtime(); } </SCRIPT> <BODY onLoad="startclock(); timerONE=window.setTimeout" TEXT="ffffff"> <CENTER><form name="clock" onSubmit="0"> <input type="text" name="face" size=13 value=""></CENTER> <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
How to ask user’s name and say welcome on your website
Here is how you can ask user's name and say welcome on your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <!-- Start of Hello Visitor JavaScript--> <!-- DESCRIPTION: This will ask the user for his/her name, then tell them WELCOME. INSTRUCTIONS: Place this script below the BODY tag, before you start the content of your page. FUNCTIONALITY: Works in both Netscape and IE. --> <SCRIPT LANGUAGE="JavaScript"> //Modified by CoffeeCup Software //This code is Copyright (c) 1998 CoffeeCup Software //All rights reserved. License is granted to a single user to //reuse this code on a personal or business Web Site. <!-- { var name = prompt ('Your name',''); var color = prompt ('Color name',''); document.write("<CENTER><FONT FACE=ARIAdL,VERDANA COLOR="+color+" SIZE=5>Welcome To Web Designer "+name+".</FONT><HR NOSHADE WIDTH=450></CENTER><P>") } //--> </SCRIPT> <!-- End of Hello Visitor JavaScript --> <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
How to determine or clock the visitor time visiting the website
Here is how you can determine or clock the visitor time visiting the website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- This scripts tell your sites visitor how long they spent at the page. --> <!-- Instructions: 1. Copy the coding into the HEAD of your HTML document 2. Add the last code into the BODY of your HTML document --> <!-- Script supplied with CoffeeCup HTML Editor --> <!-- www.coffeecup.com --> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin startday = new Date(); clockStart = startday.getTime(); function initStopwatch() { var myTime = new Date(); return((myTime.getTime() - clockStart)/1000); } function getSecs() { var tSecs = Math.round(initStopwatch()); var iSecs = tSecs % 60; var iMins = Math.round((tSecs-30)/60); var sSecs ="" + ((iSecs > 9) ? iSecs : "0" + iSecs); var sMins ="" + ((iMins > 9) ? iMins : "0" + iMins); document.forms[0].timespent.value = sMins+":"+sSecs; window.setTimeout('getSecs()',1000); } // End --> </script> <BODY onLoad="window.setTimeout('getSecs()',1)"> <CENTER> <FORM> <FONT SIZE="2" FACE="Arial">Time spent here: </FONT><input size=5 name=timespent> </FORM> </CENTER> <!-- End of Time Spent JavaScript --> <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
How to put a calculator script on your website
Here is how you can put a calculator script on your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <!-- A Simple Calculator --> <!-- Instructions: Just put this script anywhere on your webpage between the body tags and you will have a calculator for your visitors! --> <!-- Script supplied with CoffeeCup HTML Editor --> <!-- www.coffeecup.com --> <CENTER> <FORM name="Keypad" action=""> <TABLE> <B> <TABLE border=2 width=50 height=60 cellpadding=1 cellspacing=5> <TR> <TD colspan=3 align=middle> <input name="ReadOut" type="Text" size=24 value="0" width=100%> </TD> <TD </TD> <TD> <input name="btnClear" type="Button" value=" C " onclick="Clear()"> </TD> <TD><input name="btnClearEntry" type="Button" value=" CE " onclick="ClearEntry()"> </TD> </TR> <TR> <TD> <input name="btnSeven" type="Button" value=" 7 " onclick="NumPressed(7)"> </TD> <TD> <input name="btnEight" type="Button" value=" 8 " onclick="NumPressed(8)"> </TD> <TD> <input name="btnNine" type="Button" value=" 9 " onclick="NumPressed(9)"> </TD> <TD> </TD> <TD> <input name="btnNeg" type="Button" value=" +/- " onclick="Neg()"> </TD> <TD> <input name="btnPercent" type="Button" value=" % " onclick="Percent()"> </TD> </TR> <TR> <TD> <input name="btnFour" type="Button" value=" 4 " onclick="NumPressed(4)"> </TD> <TD> <input name="btnFive" type="Button" value=" 5 " onclick="NumPressed(5)"> </TD> <TD> <input name="btnSix" type="Button" value=" 6 " onclick="NumPressed(6)"> </TD> <TD> </TD> <TD align=middle><input name="btnPlus" type="Button" value=" + " onclick="Operation('+')"> </TD> <TD align=middle><input name="btnMinus" type="Button" value=" - " onclick="Operation('-')"> </TD> </TR> <TR> <TD> <input name="btnOne" type="Button" value=" 1 " onclick="NumPressed(1)"> </TD> <TD> <input name="btnTwo" type="Button" value=" 2 " onclick="NumPressed(2)"> </TD> <TD> <input name="btnThree" type="Button" value=" 3 " onclick="NumPressed(3)"> </TD> <TD> </TD> <TD align=middle><input name="btnMultiply" type="Button" value=" * " onclick="Operation('*')"> </TD> <TD align=middle><input name="btnDivide" type="Button" value=" / " onclick="Operation('/')"> </TD> </TR> <TR> <TD> <input name="btnZero" type="Button" value=" 0 " onclick="NumPressed(0)"> </TD> <TD> <input name="btnDecimal" type="Button" value=" . " onclick="Decimal()"> </TD> <TD colspan=3> </TD> <TD> <input name="btnEquals" type="Button" value=" = " onclick="Operation('=')"> </TD> </TR> </TABLE> </TABLE> </B> </FORM> </CENTER> <font face="Verdana, Arial, Helvetica" size=2> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var FKeyPad = document.Keypad; var Accumulate = 0; var FlagNewNum = false; var PendingOp = ""; function NumPressed (Num) { if (FlagNewNum) { FKeyPad.ReadOut.value = Num; FlagNewNum = false; } else { if (FKeyPad.ReadOut.value == "0") FKeyPad.ReadOut.value = Num; else FKeyPad.ReadOut.value += Num; } } function Operation (Op) { var Readout = FKeyPad.ReadOut.value; if (FlagNewNum && PendingOp != "="); else { FlagNewNum = true; if ( '+' == PendingOp ) Accumulate += parseFloat(Readout); else if ( '-' == PendingOp ) Accumulate -= parseFloat(Readout); else if ( '/' == PendingOp ) Accumulate /= parseFloat(Readout); else if ( '*' == PendingOp ) Accumulate *= parseFloat(Readout); else Accumulate = parseFloat(Readout); FKeyPad.ReadOut.value = Accumulate; PendingOp = Op; } } function Decimal () { var curReadOut = FKeyPad.ReadOut.value; if (FlagNewNum) { curReadOut = "0."; FlagNewNum = false; } else { if (curReadOut.indexOf(".") == -1) curReadOut += "."; } FKeyPad.ReadOut.value = curReadOut; } function ClearEntry () { FKeyPad.ReadOut.value = "0"; FlagNewNum = true; } function Clear () { Accumulate = 0; PendingOp = ""; ClearEntry(); } function Neg () { FKeyPad.ReadOut.value = parseFloat(FKeyPad.ReadOut.value) * -1; } function Percent () { FKeyPad.ReadOut.value = (parseFloat(FKeyPad.ReadOut.value) / 100) * parseFloat(Accumulate); } // End --> </SCRIPT> <pre><font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font></pre>
How to allow your visitors to change the background colour of your website
Here is how you can change the background colour of your website. This will allow the user to change the background color of your page.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <!-- Start of Change BackGround Color--> <!-- DESCRIPTION: This will allow the user to change the background color of your page. Neat trick. INSTRUCTIONS: Place this script anywhere in the <BODY> tag. FUNCTIONALITY: Works in both Netscape and IE. --> <!-- //Modified by CoffeeCup Software //This code is Copyright (c) 1998 CoffeeCup Software //All rights reserved. License is granted to a single user to //reuse this code on a personal or business Web Site. // --> <CENTER> <FORM> <FONT FACE="VERDANA, ARIAL"><B>Choose a background color:</B></FONT> <SELECT name="ccGround" size="1" onChange=(document.bgColor=ccGround.options[ccGround.selectedIndex].value)> <OPTION value="408080" target="1" selected>Cool Green <OPTION value="C0C0C0" target="1">Cool Grey <OPTION value="000000" target="1">Black <OPTION value="730200" target="1">DarkRed <OPTION value="231800" target="1">Brown <OPTION value="044302" target="1">DarkGreen <OPTION value="0D09A3" target="1">Dark Blue <OPTION value="808040" target="1">Avocado <OPTION value="800080" target="1">Purple <OPTION value="444444" target="1">Gray <OPTION value="FF0400" target="1">Red <OPTION value="EFE800" target="1">Yellow <OPTION value="05EF00" target="1">Green <OPTION value="0206FF" target="1">Blue <OPTION value="AE08EF" target="1">Violet <OPTION value="FF8C8A" target="1">Mauve <OPTION value="FF80FF" target="1">Pink <OPTION value="FFCCCC" target="1">Peach <OPTION value="FFCC99" target="1">Orange <OPTION value="000080" target="1">Darker Blue <OPTION value="808080" target="1">Dark Grey <OPTION value="D5CCBB" target="1">Tan <OPTION value="DDDDDD" target="1">LightGray <OPTION value="FBFF73" target="1">Light Yellow <OPTION value="7CFF7D" target="1">LightGreen <OPTION value="A6BEFF" target="1">Light Blue <OPTION value="FFFFFF" target="1">White </SELECT></FORM></CENTER> <!-- Start of Change BackGround Color--> <pre><font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font></pre>