Age verification popup with fancybox


Below code is responsible for open a Fancybox on page load and verify visitor’s age. If visitors age was 18 then cookies is set for next access without verification popup, — if not then a warning message will display.
Continue reading

Advertisements

Hide and show multi level menu in jquery


CSS code

<style>
/*menu*/
#menu
{
margin: 0;
background:url(images/menu.png);
background-repeat:no-repeat;
height:45px;
margin-top:-24px;
margin-left:15px;
padding: 0;

}
#menu li
{
float: left;
list-style: none;
font: 12px Tahoma, Arial;

}
#menu .panel
{
position:absolute;
display:none;
text-align:left;
border-top: 1px solid #9D9D9D;
border-bottom: 1px solid #9D9D9D;
background: #A9C251;
padding:7px 7px 7px 7px;
margin:-5px 2px 2px 2px;
}
#menu .panel td
{
background: url(images/arrow.png) no-repeat left ;
padding-left:10px;
}
#menu .panel a
{

color: #24313C;
height:10px;
text-decoration: none;
width: auto;
color:#000;
font-family:Arial, Helvetica, sans-serif;

font-size:12px;
font-weight:bold;
white-space: nowrap;
padding:0px 5px 5px 0px;
float:left;
display:list-item;
margin:10px 10px 10px 10px ;
}
#menu .panel a:hover
{
color:#D8D8D8;

}
#menu li .slide
{
display: block;
background: url(images/divideline.jpg) no-repeat right ;
padding: 15px 12px;
text-decoration: none;
width: 80px;
color:#000;
font-family:Arial, Helvetica, sans-serif;
font-size:13px;
font-weight:bold;
white-space: nowrap;
}
#menu li .slide:hover
{
color:#222;
}

/*end menu*/

</style>

Continue reading

Java script for Disable the cut, copy, paste and accepts the number and alphabets only


1) Java script for disable the cut, copy, paste task from the textbox

               a). By Disabling the mouse right click

function no_Cpy_Mouse(event) {
 var isRight = (event.button) ? (event.button == 2) : (event.which == 3);
    if (isRight) {
        alert('Right Click is disable.');
        return false;
    }
    return true;
}

                b). By Disabling the key control

function no_Cpy_byKey(event) {
    var forbiddenKeys = new Array('c', 'x', 'v');
    var keyCode = (event.keyCode) ? event.keyCode : event.which;
    var isCtrl;

    if (window.event)
        isCtrl = event.ctrlKey
    else
        isCtrl = (window.Event) ? ((event.modifiers & Event.CTRL_MASK) == Event.CTRL_MASK) : false;

    if (isCtrl) {
        for (i = 0; i < forbiddenKeys.length; i++) {
            if (forbiddenKeys[i] == String.fromCharCode(keyCode).toLowerCase()) {
                alert('Please type this for a reason!');
                return false;
            }
        }
    }
    return true;
 }

2. java script for accepts only numbers

function number_only(event, dec) {
     var key;
     var keychar;
     if (window.event) {
         key = window.event.keyCode;
 
     }
     else if (event) {
         key = event.which;
        

     }
     else {
        
         return true;
     }
     keychar = String.fromCharCode(key);
     if ((key == null) || (key == 0) || (key == 8 ) || (key == 9) || (key == 13) || (key == 27)) {
                  return true;
     }
              else if ((("0123456789").indexOf(keychar) > -1)) {

         return true;
     }
     else if (dec && (keychar == ".")) {
         return true;
     }
     else 
         return false;
 
 }

3. java script for accepts only alphabets

function alphabet_only() {

         var keyStroke = (event.which) ? event.which : (window.event) ? window.event.keyCode : -1;
         var returnValue = false;

         if (((keyStroke >= 65) && (keyStroke <= 90)) || ((keyStroke >= 97) && (keyStroke <= 122)))
             returnValue = true;

         if (window.event)
             window.event.returnValue = returnValue;

         return returnValue;
 }