Showing posts with label Java Script. Show all posts
Showing posts with label Java Script. Show all posts

Tuesday, July 31, 2012

Numeric value validation on TextBox

[caption id="" align="alignleft" width="300"]JQuery JQuery (Photo credit: Wikipedia)[/caption]

Hi guys, In this post i m going to explain how to perform numeric value validation in a TextBox in ASP.NET. Here i will post two diff. mechanism by using Java Script and JQuery. 

Thursday, July 05, 2012

Java Script to drag and drop image in HTML5

Hi guys, some days ago i came across a situation where i have to drag and drop a image into a rectangle in a web page. I tried following and it works using HTML5.

<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">

Thursday, June 14, 2012

Javascript code to check/uncheck all checkboxes from header check box

<script type="text/javascript">
var TotalChkBx;
var Counter;
window.onload = function()
{
TotalChkBx = parseInt('<%= this.GridView3.Rows.Count %>');
Counter = 0;
}
function SelectAll(CheckBox)
{
var TargetBaseControl = document.getElementById('<%= this.GridView3.ClientID %>');
var TargetChildControl = "chkselect";
var Inputs = TargetBaseControl.getElementsByTagName("input");
for(var n = 0; n < Inputs.length; ++n)
if(Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf(TargetChildControl,0) >= 0)
Inputs[n].checked = CheckBox.checked;
Counter = CheckBox.checked ? TotalChkBx : 0;
}
function ChildClick(CheckBox, HCheckBox)
{
var HeaderCheckBox = document.getElementById(HCheckBox);
if(CheckBox.checked && Counter < TotalChkBx)
Counter++;
else if(Counter > 0)
Counter--;
if(Counter < TotalChkBx)
HeaderCheckBox.checked = false;
else if(Counter == TotalChkBx)
HeaderCheckBox.checked = true;
}
</script>
onclick="javascript:SelectAll(this);"