Code Snippets Submitted by Jhon Smith


12 January, 2011   

Browsers already have "back" buttons, so you'd better have a darn good reason for needing to put one on your page! This is totally obtrusive, but you could fix that by only appending this button through JavaScript.

Convert a coordinate (x,y) into the index for a 1D array. For example, the coordinate (3,1) would be at array index 8 if there are 5 columns. Assumption: Arrays start at 0.

08 June, 2011   

Did you know that search engine crawlers think that 'www.yoursite.com' and 'yoursite.com' are two different websites!? We need to help the crawlers out and tell them that the two URLs are the same. We can do this with a 301 (moved permanently) redirect. The code below will redirect requests for 'yoursite.com' to 'www.yoursite.com .

11 February, 2012   

JavaScript Code to show a message box or a alert window when page opens

07 December, 2011   

Php code to guessing a number using in html page

Two objects are included here, a reader and a parser. All you need to do is instantiate the xmlParser object and let it do the job for you. nextToken() will return the next token, which can be a tag or the text between 2 tags. the isTag() will determine if this is a tag so you can do something smart with it. Lastly you can jumpTo($tagname) if...

Example shown here CSS + Inline Image Technique

14 January, 2012   

How to AccessText for TextBlock

17 December, 2012   

Example code for Add javascript in VB.Net and C#

23 January, 2013   

Adjusted for daylight saving or standard time as appropriate.

04 July, 2011   

Animation with threads by John E. Grayson

26 July, 2012   

Java code example to append text to file in Java

30 January, 2011   

Applying Even/Odd Classes

23 April, 2011   

Below is a basic feedback form script 'feedback.asp'. You can add your own validation. Once the visitor has filled in all the form textfields an email will be sent with the feedback details including the date and time and the visitor's IP address to the email specified in the script.

Sometimes you need to generate passwords for customers automatically when a new account is created. This code allows you choose the desired length and strength for the password and it is very flexible.

Automatically Discover Document Links And Apply Class

18 October, 2012   

HTML style example code for background color

This code is an example of Ban a user based on IP address

Encodes the given data with MIME base64. Base64-encoded data takes about 33% more space than the original data.

07 February, 2011   

Better Helvetica