PHP, Javascript, CSS & mySQL code snippets

This section of our website contains public source code snippets in a variety of languages which are free to use. Snippets include single lines of code to whole functions and classes.

advertisement

Current page URL
in javascript
 

Get the current title of the page using javascript and store it into a variable

Select code

 

Page title
in javascript
 

Get the current title of the page using javascript and store it into a variable

Select code

 

Close window
in javascript
 

Attempts to close the current window. Good idea for popups

Select code

 

Back button
in javascript
 

Allows you to take a user to the previous page they were on using a button

Select code

 

Convert string to upper/lower case
in javascript
 

Convert a string to all upper or lowercase in javascript

Select code

 

Get length of array
in javascript
 

Get the amount of items, or length, or an array in javascript

Select code

 

Create random number
in javascript
 

A snippet to create a random number in javascript

Select code

 

Breakout of frames
in javascript
 

Little bit of javascript which will automatically break out of frames

Select code

 

Hide and show DIV
in javascript
 

Simple little code which will allow you to toggle the display of a div

Select code

 

IE7 Add to favourites
in javascript
 

A simple add to favourites link for IE7

Select code

 

 
Tips & advice

Need coding help? Tips, tricks or advice? Check out our webmaster forums

advertisement