ip address

IP Address

Often you may want to let the visitor know that you are aware of their IP address. You can do so using a few lines of code, as shown here. Place the code where you want the IP address to appear: <SCRIPT LANGUAGE=”JavaScript”> var ip = ‘<!–#echo var=”REMOTE_ADDR”–>’; document.write(“Your IP address is” + ip); </script>

Read more

Focus OnLoad

You can put the user’s cursor inside a text box (calling the text box’ focus) as soon as the page is loaded. This helps ensure that visitors do not ‘overlook’ an important form item on your site. It only uses one line of code! This part goes into your body tag: <BODY OnLoad=”document.nameform.user.focus();”> Then you just use the name of

Read more

JavaScript Back Button

Just like your browser’s back button, the following script allows the user to press a button to returns the user to the previous page. Paste the following code where you want the button to appear on your page: <FORM> <INPUT TYPE=”Button” VALUE=”Previous Page” onClick=”history.go(-1)”> </FORM> If you would rather use a link, paste the following code where you want the

Read more


This is a plain and simple monthly calendar. It’s formatted with styles sheets so the appearance can easily be changed. In the head of your document, add the following style sheet and JavaScript code: <style type=”text/css”> span.label {color:black;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 13px Arial} span.c1 {cursor:hand;color:black;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 13px Arial} span.c2 {cursor:hand;color:red;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 13px Arial} span.c3 {cursor:hand;color:#b0b0b0;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 12px Arial} </style> <script type=”text/javascript”> function maxDays(mm, yyyy){ var mDay;

Read more
date display

Date Display

You can use this snippet to display the current date in this format:¬†Friday, June 11, 2010. Just paste the following code where you want the date to show up on your page: <SCRIPT LANGUAGE=”JavaScript”> var now = new Date(); var days = new Array(‘Sunday’,’Monday’,’Tuesday’,’Wednesday’,’Thursday’,’Friday’,’Saturday’); var months = new Array(‘January’,’February’,’March’,’April’,’May’,’June’,’July’,’August’,’September’,’October’,’November’,’December’); var date = ((now.getDate()<10) ? “0” : “”)+ now.getDate(); function fourdigits(number)

Read more