JavaScript

Disable Browser's back Button 
In this example I'm explaining how to disable browser's back button to avoid user going to previous page by clicking on back button of browser, for this we need to use javascript to prevent user navigating to previous page by hitting back button.
Just put this javascript on the html section of aspx page above head section 


<script language="JavaScript" type="text/javascript">
javascript:window.history.forward(1);
</script>

 NOTE:You need to put it on the html section of the page which we want to prevent user to visit by hitting the back button

Image in Text Box 
.tb11 {
	background:#FFFFFF url(images/search.png) no-repeat 4px 4px;
	padding:4px 4px 4px 22px;
	border:1px solid #CCCCCC;
	width:230px;
	height:18px;
}

Phone number validation : 
function NumberCheck11()
        {
            if(event.keyCode!=8 && event.keyCode!=0 && (event.keyCode<48 || event.keyCode>57))
                 {  alert("enter only numarics");
                      return false;
                  }
                else if(document.testform.TextBox7.value.length= =10)
               {
                alert("Please enter 10 digit Phone No");
                return false;
               }
        } 


Validation to enter only TEXT




function key1()
    {    if(event.keyCode<65 ||event.keyCode>90 && event.keyCode<97 || event.keyCode>122)
            { alert("enter only text");
              event.returnValue=false;
            }
        else if(event.keyCode>=1 && event.keyCode<=32 || event.keyCode= =127)
        {
            window.alert("Numbers/Special Characters Not Allowed");
            event.returnValue=false;
        }
   
    }
      

 Add onkeyup data to lable:
If we wnt to add to a lable we have to add " .innerHTML" or want to add text box we have to use" .value "
 <script language="javascript" type="text/javascript">
        function add() {

   document.getElementById('lable1').innerHTML = document.getElementById('txt_1').value;
         

 for textbox
   // document.getElementById('textbox_1').value = document.getElementById('txt_1').value;

        }

 
  Using sessions

<input name="chooser" onclick="chooserMode('text')" type="radio" />Text:
<input class="colorbox" name="colorbox_text" readonly type="text" value="<%=session["color_text"]%>" />

Footer CSS

.footerDiv{ width:100%; height:50px; border-top:#e2e2e2 1px solid; background:#f0fafe;}

.footerContainer-Left{width:286px; float:left; margin-left:20px;}
.footerContainer-Right{width:192px; float:right; padding:20px 0 0 0; margin-right:30px;}

.footerList{ width:1000px; float:left; }
.footerList ul{margin:0; padding:0;}
.footerList ul li{font-family:trebuchet MS, Arial, Helvetica, sans-serif ; font-size:16px; float:left; color:#858585; list-style-type:none; padding:20px 8px 0 8px;}
.footerList ul li span{color:#114f9b;}
.footerList ul li a{text-decoration:none; color:#5f5f5f;}
.footerList ul li a:hover{text-decoration:none; color:#1c5378;}
.sep{background:url(../images/sep.jpg) no-repeat left 25px;}
.mainContainer{width:986px; margin:0 auto;padding-bottom:20px;}

.headerDiv{ width:986px; margin:0 auto;  background:url(../images/header-img.jpg) no-repeat;}

.accountDiv{width:170px; float:right; color:#22a7e9; font-size:11px; margin:160px 100px 0 0;}

.bannerDiv{ width:882px; height:214px; float:left; border:1px #e4e4e4 solid; padding:7px 8px 7px 8px; margin:30px 0 0 4px;}

.list{width:492px; float:left; margin-top:10px;}
.list ol{margin:0; padding:0;}
.list ol li{list-style-type:none;  font-family:trebuchet MS, Arial, Helvetica, sans-serif ; font-size:17px; padding:0 2px 0 2px; }
.list ol li span{font-size:48px; color:#114f9b;}
.list ol li a{color:#ffb200; text-decoration:none;}

How to hide a DIV in certain Time period

<div id="helpdiv" style="display:block">
helpstuff here
</div>

<script type="text/javascript">
// close the div in 5 secs
window.setTimeout("closeHelpDiv();", 5000);

function closeHelpDiv(){
document.getElementById("helpdiv").style.display=" none";
}
</script>
 


My WAP secrete.....?
head.........
<meta name = \"viewport\" content = \"width = device-width\"><script type=\"text/javascript\">var updateLayout = function() {  if (window.innerWidth != currentWidth) {" +
"currentWidth = window.innerWidth; var orient = (currentWidth == 320) ? \"profile\" : \"landscape\"; document.body.setAttribute(\"orient\", orient);  window.scrollTo(0, 1);  }};" +
        "body[orient=\"portrait\"] {property: value;}body[orient=\"landscape\"] {property: value;}