Advanced Code
Go Back
Place this code on a webpage and when someone clicks it they will be returned to the page they were at before this page.
Code:
<a href=”javascript: history.back(-2)”>Back</a>
Redirect Old Domain To New Domain & Other Tricks
The best way to redirect an old web site to the new web site and keep the same search engine rankings is to use the permanent 301 redirect by creating an .htaccess file and adding some snips of code.
When a visitor/search engine requests a web page, your web server checks for a .htaccess file. Using [...]
Prevent Direct Linking
Want to prevent direct linking to your files? Sick of people linking to files that you feel should only be accessed from your website and not their’s? Read on…
Open your notepad.
Insert the follow code as it is displayed and change “mydomain.com” to your own domain name:
Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC]
RewriteCond [...]
Fading Image - Javascript
You’ve likely seen this on other websites where the images appear to be faded out and when you move your mouse over them their appear normal. This little javascript does just that.
Copy this code into your <head>Head Tags</head> in your HTML document:
Code:
<script language=”JavaScript1.2″>
function high(which2){
theobject=which2
highlighting=setInterval(”highlightit(theobject)”,50)
}
function low(which2){
clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.3
else [...]
Blinking Text - Javascript
Make your text blink with this script.
Copy this code into the HEAD of your HTML document
Code:
<SCRIPT LANGUAGE=”JavaScript”>
window.onerror = null;
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var NS4 = (bName == “Netscape” && bVer >= 4);
var IE4 = (bName == “Microsoft Internet Explorer”
&& bVer >= 4);
var NS3 = (bName == [...]
Redirect Url - JavaScript
Occasionally, you may wish to have a redirect page that pauses for a few seconds before sending the visitor off to the destination. For example, there may be important text on the redirect page you wish the visitor to get a chance to read, or a banner ad to see before proceeding. This redirect script [...]
Close Window Scripts
Add any of these cool scripts to your pop up pages for the visitor to close them. Several to choose from:
1. Closing a Regular Window from a Link Click
Code:
<a href=”javascript:window.close()”>Close</a>
2. Closing a Regular Window from an Image Click
Code:
<a href=”javascript:window.close()”>
<img border=”0″ src=”closingwindows.gif” width=”95″ height=”46″>
</a>
3. Closing a Regular Window from a Button Click
Code:
<form>
<input type=”button” [...]
Redirect out of your secret folders - ex images
Want to keep prying eyes out of your images folder or any other folder for that matter? Your images folder and some other folders can be looked at if you do not have an index.html in there. We suggest you do the following instead of a plain index.html file.
Create your index.html file that you will [...]
Break Out of Frames
How would you like to ensure that your visitors are viewing your website without being inside someone else’s frames? Add this simple piece of javascript to the head section your your HTML file:
Code:
<script language=”JavaScript”>
if (top.location.href != location.href)
top.location.href = location.href;
</script>
Simple webpage counter
Here’s a very simple webpage counter which can be used in any html page:
First open your notepad. Copy and paste this piece of code inside:
Code:
<?php
$myfile = fopen(”counter.txt”,”r”);
$count = fgets($myfile,10);
fclose($myfile);
$count+=1;
$myfile = fopen(”counter.txt”,”w”);
fwrite($myfile, $count);
echo “document.write(’You are visitor number $count’)”;
fclose($myfile);
?>
Go to Edit then “save as”. Before saving, make sure the format drop down tab is set for any [...]




