ManyCodes.com – codes & scripts Get free programming codes and tutorials!

6Aug/090

How to 301 Redirect Non-WWW to WWW URLs

Search engines consider http://manycodes.com and http://www.manycodes.com different websites. As a result, if your website has been linked to from other websites using a mix of the two URLs you are effectively splitting the potential benefit of valuable link popularity.

The Solution
Using a 301 redirect on the “non-www” version of the URL, which is essentially a “permanent” redirect in server talk, you can effectively consolidate all of your link popularity to a single URL. This consolidation will serve to increase your website’s chances of obtaining and maintaining top rankings.

How To Enable The 301 Redirect

You need to instruct the server you are hosting your website on to redirect the traffic seamlessly. To do this you need to first establish what type of server your website is hosted on. There are two main types of servers that are in use: Microsoft and Apache (Linux/Unix). Once you have established the server type you need to follow their related instructions below. Please note this is best left to a person with some technical knowledge.


A) Installing the Non-WWW 301 Redirect on a Apache Server

  1. Ensure that your hosting provider has the Apache Rewrite Module turned on; this is a definite requirement for this fix to work. In most cases your hosting provider will not have a problem enabling the module if it isn’t already enabled (it seems to be on in most circumstances).If you have access to the httpd.conf file on your server then you can actually enable the module yourself. Open the httpd.conf file, back it up somewhere in case of error (you cannot be too safe) and then uncomment the following line:LoadModule rewrite_module modules/mod_rewrite.soOnce the line is uncommented, save the file and restart the server then proceed with the following steps.
  2. Download the .htaccess file from your website’s root web folder to a folder on your machine where you can edit it.
  3. Make a copy of the .htaccess file and save it somewhere else for safe keeping in case you need to revert to the old version – do not edit this version.
  4. Open the original .htaccess you downloaded in Notepad
  5. Add the following code (in red) into the .htaccess file. Be sure to substitute “example.com” with your own website information but touch nothing else.RewriteEngine On
    RewriteCond %{HTTP_HOST} ^example.com
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]
  6. Upload the file back to your website in the exact same place you downloaded it.
  7. Once the upload is complete open a browser and try visiting the “non-www” version of your website address. If the .htaccess is working as it should you will be redirected immediately to the proper “www” version of your website. This will be reflected in your browser’s address bar.
  8. To be 100% certain this has worked appropriately I suggest visiting this URL and typing in your “non-www” website address into the HTTP Server Header Checker. This tool will show you whether the 301 redirect is being provided by the server. This is what a search engine will see when it visits the site. The result should look like the following areas in red:
    #1 Server Response: http://example.com
    HTTP Status Code: HTTP/1.1 301 Moved Permanently

    Date: Wed, 14 Mar 2007 22:49:28 GMT
    Server: Apache/1.3.27 (Unix) PHP/4.4.1 FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.6b
    Location: http://www.example.com/
    Connection: close
    Content-Type: text/html; charset=iso-8859-1
    Redirect Target: http://www.example.com/#2 Server Response: http://www.example.com/
    HTTP Status Code: HTTP/1.1 200 OK

    Date: Wed, 14 Mar 2007 22:49:28 GMT
    Server: Apache/1.3.27 (Unix) PHP/4.4.1 FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.6b
    Connection: close
    Content-Type: text/html
  9. If the redirect worked you are done! Congratulations.If this has not worked you need to restore the backup you made of the .htaccess file to your website. After the backup is restored go back and review the revised .htaccess on your computer, compare the information to the instructions above and make sure there were no mistakes. If no mistakes are found your server may require custom programming which is beyond the scope of this FAQ; please contact your hosting provider for more information.

B) Installing the Non-WWW 301 Redirect on a Microsoft IIS Server

Microsoft servers do not have a .htaccess file to alter so we suggest that you contact your hosting provider and request they make this change for you. If they are baffled or need further instructions on how to make the changes you can refer them to the tutorials referenced below:

  1. Using Internet Services Manager create a new IP-based website using the http://example.com URL or alternatively you can avoid using a unique IP by using the host header (virtual website) of www.example.com.
  2. Now verify the server headers for each website using the Server Header Checker. The server response should be 200 OK for both addresses.
  3. Now add your domain-revised version of the following ASP code to the default home page for http://example.com:< %@ Language=VBScript %>
    < %
    Response.Status=”301 Moved Permanently”
    Response.AddHeader “Location”, http://www.example.com
    %>
    Note: do not change the spacing or line placement within the above code; place it as is.
  4. Once the default page is online first visit your website via http://example.com to ensure the redirect is working. Next check the server headers for http://example.com and make sure you see the following code within #1: “HTTP Status Code: HTTP/1.1 301 Moved Permanently”. That code will confirm the 301 redirect is being properly communicated.
5Aug/090

How to Install the Latest git on CentOS 5 from Source

To install the latest git on CentOS 5 you will need to install from source since the yum repos are typically fairly far behind. Follow the instructions below and installing git will be a snap.

  1. Install Dependencies: First we need to install a couple packages via yum to cover the dependencies for building git from source.
  2. [root@server ~]#yum install curl-devel
    [root@server ~]#yum install expat-devel
    [root@server ~]#yum install gettext-devel
    [root@server ~]#yum install openssl-devel
    [root@server ~]#yum install zlib-devel 
[root@server ~]#yum install curl-devel
[root@server ~]#yum install expat-devel
[root@server ~]#yum install gettext-devel
[root@server ~]#yum install openssl-devel
[root@server ~]#yum install zlib-devel
  • Download git Source: Now download the git source by issuing the below command. Verify the latest source here.
  • [root@server ~]#cd /usr/local/src
    [root@server ~]# wget http://www.kernel.org/pub/software/scm/git/git-1.6.0.4.tar.gz
    

    [root@server ~]#cd /usr/local/src
    [root@server ~]# wget http://www.kernel.org/pub/software/scm/git/git-1.6.0.4.tar.gz
  • Build Source:Unpack the file that has been downloaded and compile the source using the “make” command.
  • [root@server ~]#tar -zxvf git-1.6.0.4.tar.gz
    [root@server ~]#cd git-1.6.0.4
    [root@server ~]#make prefix=/usr/local all
    
    [root@server ~]#tar -zxvf git-1.6.0.4.tar.gz
    [root@server ~]#cd git-1.6.0.4
    [root@server ~]#make prefix=/usr/local all
  • Install git: After successfully compiling the source you need to install git.
  • [root@server ~]#make prefix=/usr/local/ install
    
    [root@server ~]#make prefix=/usr/local/ install
  • Download git Manpages:Now let’s download the manpages. Verify the latest manpages here.
  • [root@server ~]#cd /usr/local/src
    [root@server ~]#wget http://www.kernel.org/pub/software/scm/git/git-manpages-1.6.0.4.tar.gz
    [root@server ~]#cd /usr/local/src
    [root@server ~]#wget http://www.kernel.org/pub/software/scm/git/git-manpages-1.6.0.4.tar.gz
  • Install git Manpages:Now change into the share directory and unpack the git manpages.
  • [root@server ~]#cd /usr/local/share/man
    [root@server ~]#tar -zxvf /usr/local/src/git-manpages-1.6.0.4.tar.gz
    
    [root@server ~]#cd /usr/local/share/man
    [root@server ~]#tar -zxvf /usr/local/src/git-manpages-1.6.0.4.tar.gz
  • Verify:Lets verify that git was installed successfully and the manpages are working properly.
  • [root@server ~]#git --version
    [root@server ~]#man git
    
    [root@server ~]#git --version
    [root@server ~]#man git

    After following the above steps you should be able to successfully use git.

    [root@server ~]#yum install curl-devel
    [root@server ~]#yum install expat-devel
    [root@server ~]#yum install gettext-devel
    [root@server ~]#yum install openssl-devel
    [root@server ~]#yum install zlib-devel

    28Jul/090

    How to put a clock on your website

    Here is how you 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>
    
    fCol='444444'; //face colour.
    sCol='FF0000'; //seconds colour.
    mCol='444444'; //minutes colour.
    hCol='444444'; //hours colour.
    
    Ybase=30; //Clock height.
    Xbase=30; //Clock width.
    
    
    H='...';
    H=H.split('');
    M='....';
    M=M.split('');
    S='.....';
    S=S.split('');
    NS4=(document.layers);
    NS6=(document.getElementById&&!document.all);
    IE4=(document.all);
    Ypos=0;
    Xpos=0;
    dots=12;
    Split=360/dots;
    if (NS6){
    for (i=1; i < dots+1; i++){
    document.write('<div id="n6Digits'+i+'" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial;font-size:10px;color:#'+fCol+';text-align:center;padding-top:10px">'+i+'</div>');
    }
    for (i=0; i < M.length; i++){
    document.write('<div id="Ny'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+mCol+'"></div>');
    }
    for (i=0; i < H.length; i++){
    document.write('<div id="Nz'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+hCol+'"></div>');
    }
    for (i=0; i < S.length; i++){
    document.write('<div id="Nx'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+sCol+'"></div>');
    }
    }
    if (NS4){
    dgts='1 2 3 4 5 6 7 8 9 10 11 12';
    dgts=dgts.split(' ')
    for (i=0; i < dots; i++){
    document.write('<layer name=nsDigits'+i+' top=0 left=0 height=30 width=30><center><font face=Arial size=1 color='+fCol+'>'+dgts[i]+'</font></center></layer>');
    }
    for (i=0; i < M.length; i++){
    document.write('<layer name=ny'+i+' top=0 left=0 bgcolor='+mCol+' clip="0,0,2,2"></layer>');
    }
    for (i=0; i < H.length; i++){
    document.write('<layer name=nz'+i+' top=0 left=0 bgcolor='+hCol+' clip="0,0,2,2"></layer>');
    }
    for (i=0; i < S.length; i++){
    document.write('<layer name=nx'+i+' top=0 left=0 bgcolor='+sCol+' clip="0,0,2,2"></layer>');
    }
    }
    if (IE4){
    document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
    for (i=1; i < dots+1; i++){
    document.write('<div id="ieDigits" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial;font-size:10px;color:'+fCol+';text-align:center;padding-top:10px">'+i+'</div>');
    }
    document.write('</div></div>')
    document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
    for (i=0; i < M.length; i++){
    document.write('<div id=y style="position:absolute;width:2px;height:2px;font-size:2px;background:'+mCol+'"></div>');
    }
    document.write('</div></div>')
    document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
    for (i=0; i < H.length; i++){
    document.write('<div id=z style="position:absolute;width:2px;height:2px;font-size:2px;background:'+hCol+'"></div>');
    }
    document.write('</div></div>')
    document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
    for (i=0; i < S.length; i++){
    document.write('<div id=x style="position:absolute;width:2px;height:2px;font-size:2px;background:'+sCol+'"></div>');
    }
    document.write('</div></div>')
    }
    
    
    
    function clock(){
    time = new Date ();
    secs = time.getSeconds();
    sec = -1.57 + Math.PI * secs/30;
    mins = time.getMinutes();
    min = -1.57 + Math.PI * mins/30;
    hr = time.getHours();
    hrs = -1.57 + Math.PI * hr/6 + Math.PI*parseInt(time.getMinutes())/360;
    
    if (NS6){
    Ypos=window.pageYOffset+window.innerHeight-Ybase-25;
    Xpos=window.pageXOffset+window.innerWidth-Xbase-30;
    for (i=1; i < dots+1; i++){
     document.getElementById("n6Digits"+i).style.top=Ypos-15+Ybase*Math.sin(-1.56 +i *Split*Math.PI/180)
     document.getElementById("n6Digits"+i).style.left=Xpos-15+Xbase*Math.cos(-1.56 +i*Split*Math.PI/180)
     }
    for (i=0; i < S.length; i++){
     document.getElementById("Nx"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(sec);
     document.getElementById("Nx"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(sec);
     }
    for (i=0; i < M.length; i++){
     document.getElementById("Ny"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(min);
     document.getElementById("Ny"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(min);
     }
    for (i=0; i < H.length; i++){
     document.getElementById("Nz"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(hrs);
     document.getElementById("Nz"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(hrs);
     }
    }
    if (NS4){
    Ypos=window.pageYOffset+window.innerHeight-Ybase-20;
    Xpos=window.pageXOffset+window.innerWidth-Xbase-30;
    for (i=0; i < dots; ++i){
     document.layers["nsDigits"+i].top=Ypos-5+Ybase*Math.sin(-1.045 +i*Split*Math.PI/180)
     document.layers["nsDigits"+i].left=Xpos-15+Xbase*Math.cos(-1.045 +i*Split*Math.PI/180)
     }
    for (i=0; i < S.length; i++){
     document.layers["nx"+i].top=Ypos+i*Ybase/4.1*Math.sin(sec);
     document.layers["nx"+i].left=Xpos+i*Xbase/4.1*Math.cos(sec);
     }
    for (i=0; i < M.length; i++){
     document.layers["ny"+i].top=Ypos+i*Ybase/4.1*Math.sin(min);
     document.layers["ny"+i].left=Xpos+i*Xbase/4.1*Math.cos(min);
     }
    for (i=0; i < H.length; i++){
     document.layers["nz"+i].top=Ypos+i*Ybase/4.1*Math.sin(hrs);
     document.layers["nz"+i].left=Xpos+i*Xbase/4.1*Math.cos(hrs);
     }
    }
    
    if (IE4){
    Ypos=document.body.scrollTop+window.document.body.clientHeight-Ybase-20;
    Xpos=document.body.scrollLeft+window.document.body.clientWidth-Xbase-20;
    for (i=0; i < dots; ++i){
     ieDigits[i].style.pixelTop=Ypos-15+Ybase*Math.sin(-1.045 +i *Split*Math.PI/180)
     ieDigits[i].style.pixelLeft=Xpos-15+Xbase*Math.cos(-1.045 +i *Split*Math.PI/180)
     }
    for (i=0; i < S.length; i++){
     x[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(sec);
     x[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(sec);
     }
    for (i=0; i < M.length; i++){
     y[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(min);
     y[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(min);
     }
    for (i=0; i < H.length; i++){
     z[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(hrs);
     z[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(hrs);
     }
    }
    setTimeout('clock()',100);
    }
    clock();
    //-->
    </SCRIPT>
    
    <SCRIPT language=JavaScript>
    
    fCol='444444'; //face colour.
    sCol='FF0000'; //seconds colour.
    mCol='444444'; //minutes colour.
    hCol='444444'; //hours colour.
    
    Ybase=30; //Clock height.
    Xbase=30; //Clock width.
    
    </body>
    
    <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
    
    28Jul/090

    How to get a nice menu with java script on your website

    Here is how you can How to get a nice menu with java 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 -->
    <!-- START OF Watermark Navigation Menu DHTML --><!-- START OF Watermark Navigation Menu DHTML -->
    
    
    <!-- SUMMARY BRIEF
    
     This DHTML script will make a navigation menu
     that will follow your screen as you scroll,
     kind of like the old Geocities™ watermark.
    
     Look through the code for comments that will
     tell you where to change the code to configure
     it how you want in order to display the links
     that you want.
    
    -->
    
    
    <!-- Put this code inside of your <HEAD> tag. -->
    
    
    <STYLE TYPE="text/css">
    <!--
    
    .menuheader {
     BORDER-COLOR : #000000 ;
     cursor : hand ;
     Border-Left : #000000 ;
     Border-Top : #000000 ;
     Padding-Left : 1px ;
     Padding-Top : 1px ;
     Background-Color : #000000 ;
    }
    
    .menu {
     Background-Color : white ;
    }
    
    .home {
     cursor : hand ;
    }
    
    .menulinks {
     text-decoration:none;
    }
    
    //-->
    </STYLE>
    
    
    <!-- Put this code inside of your <BODY> tag on your page, but OUTSIDE of any other tags. This can NOT be inside of any other tags on your page. -->
    
    
    <SCRIPT Language="Javascript1.2">
    <!--
    
    ///////////////////////////////////////////////////////////////
    // Change the width and placement of the menu on the page below.
    ///////////////////////////////////////////////////////////////
    
    var menuwidth=110
    var offsetleft=10
    var offsettop=10
    
    var ns4=document.layers?1:0
    var ie4=document.all?1:0
    var ns6=document.getElementById&&!document.all?1:0
    
    function makeStatic() {
    if (ie4) {object1.style.pixelTop=document.body.scrollTop+offsettop}
    else if (ns6) {document.getElementById("object1").style.top=window.pageYOffset+offsettop}
    else if (ns4) {eval(document.object1.top=eval(window.pageYOffset+offsettop));}
    setTimeout("makeStatic()",0);
    }
    
    if (ie4||ns6) {document.write('<span ALIGN="CENTER" ID="object1" STYLE="Position:absolute; Top:20; Left:'+offsetleft+'; Z-Index:5;cursor:hand;background-color:black;"><TABLE BORDER="1" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="black" bgcolor="white">')}
    else if (ns4){ document.write('<LAYER top="20" name="object1" left="'+offsetleft+'" BGCOLOR=black><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="1"><TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="'+menuwidth+'">')}
    
    ///////////////////////////////////////////////////////////////
    // Change the name of the menu (the text at the top) below.
    // You can also shange the font face, size and border colors.
    ///////////////////////////////////////////////////////////////
    
    if (ie4||ns6||ns4)
    document.write('<TR><TD BGCOLOR="#3399FF" BORDERCOLORDARK="#99CCFF" BORDERCOLORLIGHT="#003399"><P ALIGN=CENTER><FONT SIZE="4" FACE=ARIAL>Navigation</FONT></TD></TR>')
    
    var menui = new Array();
    var menul = new Array();
    
    ///////////////////////////////////////////////////////////////
    // Edit menus listing here. You can make as many as you need,
    // just make sure that the numbers go up in order correctly.
    // The "menui" variables are the actual link text that will
    // show up in the menu. The "menul" variables are the URLs
    // that match the text displayed there.
    ///////////////////////////////////////////////////////////////
    
    menui[0]="CoffeeCup Software";
    menui[1]="CoffeeCup HTML Editor";
    menui[2]="CoffeeCup Help Site";
    menui[3]="CoffeeCup Site Map";
    menui[4]="Other CoffeeCup Products";
    menui[5]="Bob & Larry\'s Free Stuff";
    menui[6]="About CoffeeCup Software";
    menui[7]="Bluedomino Webhosting";
    
    menul[0]="http://www.webloger.5u.com";
    menul[1]="http://www.webloger.5u.com";
    menul[2]="http://www.webloger.5u.com";
    menul[3]="http://www.webloger.5u.com";
    menul[4]="http://www.webloger.5u.com";
    menul[5]="http://www.webloger.5u.com";
    menul[6]="http://www.webloger.5u.com";
    menul[7]="http://www.webloger.5u.com";
    
    for (i=0;i<=menui.length-1;i++)
    
    ///////////////////////////////////////////////////////////////
    // You can change table cell background colors below.
    // Just change the color names to whatever you want,
    // but do NOT change any other code.
    ///////////////////////////////////////////////////////////////
    
    if (ie4||ns6) {document.write('<TR><TD BORDERCOLOR="white" ONCLICK="location=\''+menul[i]+'\'" onmouseover="className=\'menuheader\'" onMouseout="className=\'menu\'"><CENTER><FONT>'+menui[i]+'</FONT></TD></TR>')}
    else if (ns4){document.write('<TR><TD BGCOLOR="white"><ILAYER><LAYER width="'+menuwidth+'" onmouseover="bgColor=\'yellow\'" onmouseout="bgColor=\'white\'"><CENTER><A HREF="'+menul[i]+'">'+menui[i]+'</A></CENTER></LAYER></ILAYER></TD></TR>')}
    
    if (ie4||ns6) {document.write('</TABLE></span>')}
    else if (ns4){document.write('</TABLE></TD></TR></TABLE></LAYER>')}
    
    function menu3(){
    if (ns6||ie4||ns4)
    makeStatic()
    }
    
    window.onload=menu3
    
    //-->
    </SCRIPT>
    
    
    <!-- END OF Watermark Navigation Menu DHTML -->
    
    
    <!-- SUMMARY BRIEF
    
     This DHTML script will make a navigation menu
     that will follow your screen as you scroll,
     kind of like the old Geocities™ watermark.
    
     Look through the code for comments that will
     tell you where to change the code to configure
     it how you want in order to display the links
     that you want.
    
    -->
    
    
    <!-- Put this code inside of your <HEAD> tag. -->
    
    
    <STYLE TYPE="text/css">
    <!--
    
    .menuheader {
     BORDER-COLOR : #000000 ;
     cursor : hand ;
     Border-Left : #000000 ;
     Border-Top : #000000 ;
     Padding-Left : 1px ;
     Padding-Top : 1px ;
     Background-Color : #000000 ;
    }
    
    .menu {
     Background-Color : white ;
    }
    
    .home {
     cursor : hand ;
    }
    
    .menulinks {
     text-decoration:none;
    }
    
    //-->
    </STYLE>
    
    
    <!-- Put this code inside of your <BODY> tag on your page, but OUTSIDE of any other tags. This can NOT be inside of any other tags on your page. -->
    
    
    <SCRIPT Language="Javascript1.2">
    <!--
    
    ///////////////////////////////////////////////////////////////
    // Change the width and placement of the menu on the page below.
    ///////////////////////////////////////////////////////////////
    
    var menuwidth=110
    var offsetleft=10
    var offsettop=10
    
    var ns4=document.layers?1:0
    var ie4=document.all?1:0
    var ns6=document.getElementById&&!document.all?1:0
    
    function makeStatic() {
    if (ie4) {object1.style.pixelTop=document.body.scrollTop+offsettop}
    else if (ns6) {document.getElementById("object1").style.top=window.pageYOffset+offsettop}
    else if (ns4) {eval(document.object1.top=eval(window.pageYOffset+offsettop));}
    setTimeout("makeStatic()",0);
    }
    
    if (ie4||ns6) {document.write('<span ALIGN="CENTER" ID="object1" STYLE="Position:absolute; Top:20; Left:'+offsetleft+'; Z-Index:5;cursor:hand;background-color:black;"><TABLE BORDER="1" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="black" bgcolor="white">')}
    else if (ns4){ document.write('<LAYER top="20" name="object1" left="'+offsetleft+'" BGCOLOR=black><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="1"><TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="'+menuwidth+'">')}
    
    ///////////////////////////////////////////////////////////////
    // Change the name of the menu (the text at the top) below.
    // You can also shange the font face, size and border colors.
    ///////////////////////////////////////////////////////////////
    
    if (ie4||ns6||ns4)
    document.write('<TR><TD BGCOLOR="#3399FF" BORDERCOLORDARK="#99CCFF" BORDERCOLORLIGHT="#003399"><P ALIGN=CENTER><FONT SIZE="4" FACE=ARIAL>Navigation</FONT></TD></TR>')
    
    var menui = new Array();
    var menul = new Array();
    
    ///////////////////////////////////////////////////////////////
    // Edit menus listing here. You can make as many as you need,
    // just make sure that the numbers go up in order correctly.
    // The "menui" variables are the actual link text that will
    // show up in the menu. The "menul" variables are the URLs
    // that match the text displayed there.
    ///////////////////////////////////////////////////////////////
    
    menui[0]="CoffeeCup Software";
    menui[1]="CoffeeCup HTML Editor";
    menui[2]="CoffeeCup Help Site";
    menui[3]="CoffeeCup Site Map";
    menui[4]="Other CoffeeCup Products";
    menui[5]="Bob & Larry\'s Free Stuff";
    menui[6]="About CoffeeCup Software";
    menui[7]="Bluedomino Webhosting";
    
    menul[0]="http://www.javakhafan.9f.com";
    menul[1]="http://www.javakhafan.9f.com";
    menul[2]="http://www.javakhafan.9f.com";
    menul[3]="http://www.javakhafan.9f.com";
    menul[4]="http://www.javakhafan.9f.com";
    menul[5]="http://www.javakhafan.9f.com";
    menul[6]="http://www.javakhafan.9f.com";
    menul[7]="http://www.javakhafan.9f.com";
    
    for (i=0;i<=menui.length-1;i++)
    
    ///////////////////////////////////////////////////////////////
    // You can change table cell background colors below.
    // Just change the color names to whatever you want,
    // but do NOT change any other code.
    ///////////////////////////////////////////////////////////////
    
    if (ie4||ns6) {document.write('<TR><TD BORDERCOLOR="white" ONCLICK="location=\''+menul[i]+'\'" onmouseover="className=\'menuheader\'" onMouseout="className=\'menu\'"><CENTER><FONT>'+menui[i]+'</FONT></TD></TR>')}
    else if (ns4){document.write('<TR><TD BGCOLOR="white"><ILAYER><LAYER width="'+menuwidth+'" onmouseover="bgColor=\'yellow\'" onmouseout="bgColor=\'white\'"><CENTER><A HREF="'+menul[i]+'">'+menui[i]+'</A></CENTER></LAYER></ILAYER></TD></TR>')}
    
    if (ie4||ns6) {document.write('</TABLE></span>')}
    else if (ns4){document.write('</TABLE></TD></TR></TABLE></LAYER>')}
    
    function menu3(){
    if (ns6||ie4||ns4)
    makeStatic()
    }
    
    window.onload=menu3
    
    //-->
    </SCRIPT>
    
    
    <!-- END OF Watermark Navigation Menu DHTML -->
    
    <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
    
    28Jul/090

    How to get a moving text status on your website

    Here is how you can get a moving text status 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 -->
    <!--   DESCRIPTION:  This script will make your status message slide into place.  Neat effect.
    
     INSTRUCTIONS:  Place this script in the BODY tags of
    your webpage.  Then place the appropriate message in the var msg value.
    
     FUNCTIONALITY: Works in both Netscape and IE.
    
    
    
    //Modified by CoffeeCup Software
    //This code is Copyright (c) 1997 CoffeeCup Software
    //all rights reserved. License is granted to a single user to
    //reuse this code on a personal or business Web Site.
    
    -->
    
    <BODY onLoad="timerONE=window.setTimeout('slide(120,0)',20);">
    
    <SCRIPT LANGUAGE="JavaScript">
    
    function slide(jumpSpaces,position) {
     var msg = "This JavaScript will slide in your desired message....Cool...isn't it???.......drink more coffee"
     var out = ""
     if (endScroll) {return false}
     for (var i=0; i<position; i++)
     {out += msg.charAt(i)}
     for (i=1;i<jumpSpaces;i++)
     {out += " "}
     out += msg.charAt(position)
     window.status = out
     if (jumpSpaces <= 1) {
     position++
     if (msg.charAt(position) == ' ')
     {position++ }
     jumpSpaces = 100-position
     } else if (jumpSpaces >  3)
     {jumpSpaces *= .75}
     else
     {jumpSpaces--}
     if (position != msg.length) {
     var cmd = "slide(" + jumpSpaces + "," + position + ")";
     scrollID = window.setTimeout(cmd,5);
     } else {
     scrolling = false
     return false
     }
     return true
    }
    function ccSetup() {
     if (scrolling)
     if (!confirm('Re-initialize slide?'))
     return false
     endScroll = true
     scrolling = true
     var killID = window.setTimeout('endScroll=false',6)
     scrollID = window.setTimeout('slide(100,0)',10)
     return true
    }
    var scrollID = Object
    var scrolling = false
    var endScroll = false
    </SCRIPT>
    <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
    
    28Jul/090

    How to have a text alert when entering and exiting your website

    Here is how you can have a text alert when entering and exiting 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" type="text/javascript">
    
    alert("Welcome to my weblog")
    
    </script>
    
    <body>
    <h1>
    
    <!-- hide script from old browsers -->
    <!--this is on example of a long JavaScript comment-->
    
    <script language="javascript" type="text/javascript">
    
    document.write("IranJavaScript")
    
    //end hiding script from old browsers -->
    </script>
    </h1>
    
    </body>
    
    <!--   DESCRIPTION:  This will cause an elert message before your visitor leaves (OR reloads) your page.
     INSTRUCTIONS:  Place this tag where your BODY tag is.  Make changes to attributes (TEXT, LINK, VLINK, BGCOLOR, etc.) as necessary.
     FUNCTIONALITY: Works in both Netscape and IE.
    
    //Modified by CoffeeCup Software
    //This code is Copyright (c) 1997 CoffeeCup Software
    //all rights reserved. License is granted to a single user to
    //reuse this code on a personal or business Web Site.
    -->
    
    
    <BODY onUnload="window.alert(' Good Bye ')">
    
    
    </BODY>
    <!--   DESCRIPTION:  This will cause an elert message before your visitor leaves (OR reloads) your page.
     INSTRUCTIONS:  Place this tag where your BODY tag is.  Make changes to attributes (TEXT, LINK, VLINK, BGCOLOR, etc.) as necessary.
     FUNCTIONALITY: Works in both Netscape and IE.
    
    //Modified by CoffeeCup Software
    //This code is Copyright (c) 1997 CoffeeCup Software
    //all rights reserved. License is granted to a single user to
    //reuse this code on a personal or business Web Site.
    -->
    
    
    <BODY onUnload="window.alert(' Good Bye ')">
    
    
    </BODY>
    
    <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
    
    28Jul/090

    How to Close the browser with a button

    Here is how you can close the browser with a button.

    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 Close Browser Script -->
    <!-- When the "Close Window" button is clicked, this script
     will close the browser window that the webpage is in.
    -->
    <script language="JavaScript">
    <!--
    
    function closeIt() {
     close();
    }
    
    // -->
    </script>
    
    <center>
    <form>
    <input type=button value="Close Window" onClick="closeIt()">
    </form>
    </center>
    
    <!-- End of Close Browser Script -->
    
    <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
    
    28Jul/090

    How to put a Google search box on your website

    Here is how you can put a Google search box 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 -->
    <!-- Search Google -->
    <center>
    <FORM method=GET action="http://www.google.com/search">
    <TABLE bgcolor="#FFFFFF"><tr><td>
    <A HREF="http://www.google.com/">
    <IMG SRC="http://www.google.com/logos/Logo_40wht.gif" <br></A>
    <INPUT TYPE=text name=q size=31 maxlength=255 value="">
    <INPUT TYPE=hidden name=hl value="en">
    <INPUT type=submit name=btnG VALUE="Google Search">
    </td></tr></TABLE>
    </FORM>
    </center>
    <!-- Search Google -->
    
    <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
    
    28Jul/091

    How to make the text to rain on your website

    Here is how you can make the text to rain 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 -->
    <body>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    var no = 50;
    var speed = 1;
    var ns4up = (document.layers) ? 1 : 0;
    var ie4up = (document.all) ? 1 : 0;
    var s, x, y, sn, cs;
    var a, r, cx, cy;
    var i, doc_width = 800, doc_height = 600;
    if (ns4up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
    }
    else
    if (ie4up) {
    doc_width = document.body.clientWidth;
    doc_height = document.body.clientHeight;
    }
    x = new Array();
    y = new Array();
    r = new Array();
    cx = new Array();
    cy = new Array();
    s = 8;
    for (i = 0; i < no; ++ i) {
    initRain();
    if (ns4up) {
    if (i == 0) {
    document.write("<layer name=\"dot"+ i +"\" left=\"1\" ");
    document.write("top=\"1\" visibility=\"show\"><font color=\"blue\">");
    document.write(",</font></layer>");
    }
    else {
    document.write("<layer name=\"dot"+ i +"\" left=\"1\" ");
    document.write("top=\"1\" visibility=\"show\"><font color=\"blue\">");
    document.write(",</font></layer>");
     }
    }
    else
    if (ie4up) {
    if (i == 0) {
    document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
    document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
    document.write("visible; TOP: 15px; LEFT: 15px;\"><font color=\"blue\">");
    document.write(",</font></div>");
    }
    else {
    document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
    document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
    document.write("visible; TOP: 15px; LEFT: 15px;\"><font color=\"blue\">");
    document.write(",</font></div>");
     }
     }
    }
    function initRain() {
    a = 6;
    r[i] = 1;
    sn = Math.sin(a);
    cs = Math.cos(a);
    cx[i] = Math.random() * doc_width + 1;
    cy[i] = Math.random() * doc_height + 1;
    x[i] = r[i] * sn + cx[i];
    y[i] = cy[i];
    }
    function makeRain() {
    r[i] = 1;
    cx[i] = Math.random() * doc_width + 1;
    cy[i] = 1;
    x[i] = r[i] * sn + cx[i];
    y[i] = r[i] * cs + cy[i];
    }
    function updateRain() {
    r[i] += s;
    x[i] = r[i] * sn + cx[i];
    y[i] = r[i] * cs + cy[i];
    }
    function raindropNS() {
    for (i = 0; i < no; ++ i) {
    updateRain();
    if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) {
    makeRain();
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
    }
    document.layers["dot"+i].top = y[i];
    document.layers["dot"+i].left = x[i];
    }
    setTimeout("raindropNS()", speed);
    }
    function raindropIE() {
    for (i = 0; i < no; ++ i) {
    updateRain();
    if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) {
    makeRain();
    doc_width = document.body.clientWidth;
    doc_height = document.body.clientHeight;
    }
    document.all["dot"+i].style.pixelTop = y[i];
    document.all["dot"+i].style.pixelLeft = x[i];
    }
    setTimeout("raindropIE()", speed);
    }
    if (ns4up) {
    raindropNS();
    }
    else
    if (ie4up) {
    raindropIE();
    }
    //  End -->
    </script>
    </body>
    
    <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
    
    Tagged as: , , , 1 Comment
    22Jul/090

    How to make falling leaves appear in the background of your webpage

    Here is how you can make the title of the your webpage scroll.

    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="JavaScript1.2">
    
    //Pre-load your image below!
    grphcs=new Array(6)
    Image0=new Image();
    Image0.src=grphcs[0]="http://javascriptfreecode.com/images/barg.gif";
    Image1=new Image();
    Image1.src=grphcs[1]="http://javascriptfreecode.com/images/barg.gif"
    Image2=new Image();
    Image2.src=grphcs[2]="http://javascriptfreecode.com/images/barg.gif"
    Image3=new Image();
    Image3.src=grphcs[3]="http://javascriptfreecode.com/images/barg.gif"
    Image4=new Image();
    Image4.src=grphcs[4]="http://javascriptfreecode.com/images/barg.gif"
    Image5=new Image();
    Image5.src=grphcs[5]="http://javascriptfreecode.com/images/barg.gif"
    
    Amount=8; //Smoothness depends on image file size, the smaller the size the more you can use!
    Ypos=new Array();
    Xpos=new Array();
    Speed=new Array();
    Step=new Array();
    Cstep=new Array();
    ns=(document.layers)?1:0;
    ns6=(document.getElementById&&!document.all)?1:0;
    
    if (ns){
    for (i = 0; i < Amount; i++){
    var P=Math.floor(Math.random()*grphcs.length);
    rndPic=grphcs[P];
    document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0><img src="+rndPic+"></LAYER>");
    }
    }
    else{
    document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
    for (i = 0; i < Amount; i++){
    var P=Math.floor(Math.random()*grphcs.length);
    rndPic=grphcs[P];
    document.write('<img id="si'+i+'" src="'+rndPic+'" style="position:absolute;top:0px;left:0px">');
    }
    document.write('</div></div>');
    }
    WinHeight=(ns||ns6)?window.innerHeight:window.document.body.clientHeight;
    WinWidth=(ns||ns6)?window.innerWidth-70:window.document.body.clientWidth;
    for (i=0; i < Amount; i++){
     Ypos[i] = Math.round(Math.random()*WinHeight);
     Xpos[i] = Math.round(Math.random()*WinWidth);
     Speed[i]= Math.random()*5+3;
     Cstep[i]=0;
     Step[i]=Math.random()*0.1+0.05;
    }
    function fall(){
    var WinHeight=(ns||ns6)?window.innerHeight:window.document.body.clientHeight;
    var WinWidth=(ns||ns6)?window.innerWidth-70:window.document.body.clientWidth;
    var hscrll=(ns||ns6)?window.pageYOffset:document.body.scrollTop;
    var wscrll=(ns||ns6)?window.pageXOffset:document.body.scrollLeft;
    for (i=0; i < Amount; i++){
    sy = Speed[i]*Math.sin(90*Math.PI/180);
    sx = Speed[i]*Math.cos(Cstep[i]);
    Ypos[i]+=sy;
    Xpos[i]+=sx;
    if (Ypos[i] > WinHeight){
    Ypos[i]=-60;
    Xpos[i]=Math.round(Math.random()*WinWidth);
    Speed[i]=Math.random()*5+3;
    }
    if (ns){
    document.layers['sn'+i].left=Xpos[i];
    document.layers['sn'+i].top=Ypos[i]+hscrll;
    }
    else if (ns6){
    document.getElementById("si"+i).style.left=Math.min(WinWidth,Xpos[i]);
    document.getElementById("si"+i).style.top=Ypos[i]+hscrll;
    }
    else{
    eval("document.all.si"+i).style.left=Xpos[i];
    eval("document.all.si"+i).style.top=Ypos[i]+hscrll;
    }
    Cstep[i]+=Step[i];
    }
    setTimeout('fall()',20);
    }
    
    window.onload=fall
    //-->
    </script>
    <pre><font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font></pre>
    </pre>