Thursday, November 2, 2017
Tuesday, October 31, 2017
কি বোর্ড এর আপ ডাউন বাটন ক্লিক করে জাভাস্ক্রিপ্ট দিয়ে টেবিলের রো সিলেক্ট
(function () {
var trows = document.getElementById('table_Return').rows, t = trows.length, trow, nextrow,
// rownum = document.getElementById('rownum'),
addEvent = (function () {
return window.addEventListener ? function (el, ev, f) {
el.addEventListener(ev, f, false); //modern browsers
} : window.attachEvent ? function (el, ev, f) {
el.attachEvent('on' + ev, function (e) { f.apply(el, [e]); }); //IE 8 and less
} : function () { return; }; //a very old browser (IE 4 or less, or Mozilla, others, before Netscape 6), so let's skip those
})();
// rownum.value = rownum.defaultValue; //reset for browsers that remember input values on reload
while (--t > -1) {
trow = trows[t];
trow.className = 'normal';
addEvent(trow, 'click', highlightRow);
}//end while
function highlightRow(gethighlight) { //now dual use - either set or get the highlighted row
gethighlight = gethighlight === true;
var t = trows.length;
while (--t > -1) {
trow = trows[t];
if (gethighlight && trow.className === 'highlighted') { return t; }
else if (!gethighlight) {
if (trow !== this) { trow.className = 'normal'; }
else if (this.className === 'normal') {
//rownum.value = t;
}
else {
//rownum.value = rownum.defaultValue;
}
}
}//end while
return gethighlight ? null : this.className = this.className === 'highlighted' ? 'normal' : 'highlighted';
}//end function
function movehighlight(way, e) {
e.preventDefault && e.preventDefault();
e.returnValue = false;
var idx = highlightRow(true); //gets current index or null if none highlighted
if (typeof idx === 'number') {//there was a highlighted row
idx += way; //increment\decrement the index value
if (idx && (nextrow = trows[idx])) { return highlightRow.apply(nextrow); } //index is > 0 and a row exists at that index
else if (idx) { return highlightRow.apply(trows[1]); } //index is out of range high, go to first row
return highlightRow.apply(trows[trows.length - 1]); //index is out of range low, go to last row
}
return highlightRow.apply(trows[way > 0 ? 1 : trows.length - 1]); //none was highlighted - go to 1st if down arrow, last if up arrow
}//end function
function processkey(e) {
switch (e.keyCode) {
case 38: {//up arrow
return movehighlight(-1, e)
}
case 40: {//down arrow
return movehighlight(1, e);
}
default: {
return true;
}
}
}//end function
addEvent(document, 'keydown', processkey);
addEvent(window, 'unload', function () { }); //optional, resets the page for browsers that remember the script state on back and forward buttons
}/* end function */)();//execute function and end script
var trows = document.getElementById('table_Return').rows, t = trows.length, trow, nextrow,
// rownum = document.getElementById('rownum'),
addEvent = (function () {
return window.addEventListener ? function (el, ev, f) {
el.addEventListener(ev, f, false); //modern browsers
} : window.attachEvent ? function (el, ev, f) {
el.attachEvent('on' + ev, function (e) { f.apply(el, [e]); }); //IE 8 and less
} : function () { return; }; //a very old browser (IE 4 or less, or Mozilla, others, before Netscape 6), so let's skip those
})();
// rownum.value = rownum.defaultValue; //reset for browsers that remember input values on reload
while (--t > -1) {
trow = trows[t];
trow.className = 'normal';
addEvent(trow, 'click', highlightRow);
}//end while
function highlightRow(gethighlight) { //now dual use - either set or get the highlighted row
gethighlight = gethighlight === true;
var t = trows.length;
while (--t > -1) {
trow = trows[t];
if (gethighlight && trow.className === 'highlighted') { return t; }
else if (!gethighlight) {
if (trow !== this) { trow.className = 'normal'; }
else if (this.className === 'normal') {
//rownum.value = t;
}
else {
//rownum.value = rownum.defaultValue;
}
}
}//end while
return gethighlight ? null : this.className = this.className === 'highlighted' ? 'normal' : 'highlighted';
}//end function
function movehighlight(way, e) {
e.preventDefault && e.preventDefault();
e.returnValue = false;
var idx = highlightRow(true); //gets current index or null if none highlighted
if (typeof idx === 'number') {//there was a highlighted row
idx += way; //increment\decrement the index value
if (idx && (nextrow = trows[idx])) { return highlightRow.apply(nextrow); } //index is > 0 and a row exists at that index
else if (idx) { return highlightRow.apply(trows[1]); } //index is out of range high, go to first row
return highlightRow.apply(trows[trows.length - 1]); //index is out of range low, go to last row
}
return highlightRow.apply(trows[way > 0 ? 1 : trows.length - 1]); //none was highlighted - go to 1st if down arrow, last if up arrow
}//end function
function processkey(e) {
switch (e.keyCode) {
case 38: {//up arrow
return movehighlight(-1, e)
}
case 40: {//down arrow
return movehighlight(1, e);
}
default: {
return true;
}
}
}//end function
addEvent(document, 'keydown', processkey);
addEvent(window, 'unload', function () { }); //optional, resets the page for browsers that remember the script state on back and forward buttons
}/* end function */)();//execute function and end script
Saturday, October 21, 2017
জাভা স্ক্রিপ্ট দিয়ে অনেক গুলো টেক্সট বক্সের ভ্যালু যোগ করা।
জাভা স্ক্রিপ্ট দিয়ে খুব সহজেই অনেক গুলো টেক্সট বক্সের ভ্যালু যোগ করা যায়,
নিম্নের পদ্ধতিতে ঃ
//--------------------------------------------
var TotalAmount = 0,
Amount = document.querySelectorAll('.C_Amount');
for (i = 0; i < C_Amount.length; i++) {
TotalAmount += parseFloat(C_Amount[i].value || 0);
}
alert (TotalAmount );
//--------------------------------------------
নিম্নের পদ্ধতিতে ঃ
//--------------------------------------------
var TotalAmount = 0,
Amount = document.querySelectorAll('.C_Amount');
for (i = 0; i < C_Amount.length; i++) {
TotalAmount += parseFloat(C_Amount[i].value || 0);
}
alert (TotalAmount );
//--------------------------------------------
জাভা-স্ক্রিপ্ট দিয়ে কি-বোর্ড বাটন প্রেস ধরা।
জাভা-স্ক্রিপ্ট দিয়ে আমরা খুব সহজে কি-বোর্ড বাটন প্রেস ধরতে পারি।
নিম্ন পদ্ধতিতে ঃ
$(document).ready(function () {
document.addEventListener("keydown", keyPress, false);
)
});
function keyPress(e) {
var keyCode = e.keyCode;
// এই কি কোড ভালু ধরে অ্যাকশান ধরা যায়।
if (keyCode === 13) {
alert("You Press Enter");
}
if (keyCode === 113) {
alert("You Press F2");
}
if (keyCode === 114) {
alert("You Press F3");
}
if (keyCode === 115) {
alert("You Press F4");
}
if (keyCode === 117) {
alert("You Press F6");
}
if (keyCode === 119) {
alert("You Press F8");
}
if (keyCode === 120) {
alert("You Press F9");
}
}
Saturday, August 27, 2016
এক টেবিল থেকে অন্য টেবিলের ডাটা আপডেট
এক টেবিল থেকে অন্য টেবিলের ডাটা আপডেট
----------------------------------------------------------
UPDATE FirstTable
SET FirstTable.AutoID = 2ndTable.AutoID
FROM FirstTable JOIN 2ndTable
ON FirstTable.AutoID = 2ndTable.AutoID
Where 2ndTable.AutoID =24
-------------------------------------------------
Wednesday, August 24, 2016
কোন টেবিলের রো শূন্য থেকে শুরু করবার উপায়।
কোন টেবিলের রো শূন্য থেকে শুরু করবার উপায়।
টেবিলের সব ডাটা ফেলে দিয়ে এই লাইন এক্সিউট করতে হবে
টেবিলের সব ডাটা ফেলে দিয়ে এই লাইন এক্সিউট করতে হবে
DBCC CHECKIDENT ("ClassStudent", RESEED, 0);
Tuesday, July 26, 2016
Converting any number in words
Procedure :
CREATE FUNCTION fnNumberToWords(@Number as BIGINT)
RETURNS VARCHAR(1024)
AS
BEGIN
DECLARE @Below20 TABLE (ID int identity(0,1), Word varchar(32))
DECLARE @Below100 TABLE (ID int identity(2,1), Word varchar(32))
INSERT @Below20 (Word) VALUES
( 'Zero'), ('One'),( 'Two' ), ( 'Three'),
( 'Four' ), ( 'Five' ), ( 'Six' ), ( 'Seven' ),
( 'Eight'), ( 'Nine'), ( 'Ten'), ( 'Eleven' ),
( 'Twelve' ), ( 'Thirteen' ), ( 'Fourteen'),
( 'Fifteen' ), ('Sixteen' ), ( 'Seventeen'),
('Eighteen' ), ( 'Nineteen' )
INSERT @Below100 VALUES ('Twenty'), ('Thirty'),('Forty'), ('Fifty'),
('Sixty'), ('Seventy'), ('Eighty'), ('Ninety')
DECLARE @English varchar(1024) =
(
SELECT Case
WHEN @Number = 0 THEN ''
WHEN @Number BETWEEN 1 AND 19
THEN (SELECT Word FROM @Below20 WHERE ID=@Number)
WHEN @Number BETWEEN 20 AND 99
THEN (SELECT Word FROM @Below100 WHERE ID=@Number/10)+ '-' +
dbo.fnNumberToWords( @Number % 10)
WHEN @Number BETWEEN 100 AND 999
THEN (dbo.fnNumberToWords( @Number / 100))+' Hundred '+
dbo.fnNumberToWords( @Number % 100)
WHEN @Number BETWEEN 1000 AND 999999
THEN (dbo.fnNumberToWords( @Number / 1000))+' Thousand '+
dbo.fnNumberToWords( @Number % 1000)
WHEN @Number BETWEEN 1000000 AND 999999999
THEN (dbo.fnNumberToWords( @Number / 1000000))+' Million '+
dbo.fnNumberToWords( @Number % 1000000)
WHEN @Number BETWEEN 1000000000 AND 999999999999
THEN (dbo.fnNumberToWords( @Number / 1000000000))+' Billion '+
dbo.fnNumberToWords( @Number % 1000000000)
WHEN @Number BETWEEN 1000000000000 AND 999999999999999
THEN (dbo.fnNumberToWords( @Number / 1000000000000))+' Trillion '+
dbo.fnNumberToWords( @Number % 1000000000000)
WHEN @Number BETWEEN 1000000000000000 AND 999999999999999999
THEN (dbo.fnNumberToWords( @Number / 1000000000000000))+' Quadrillion '+
dbo.fnNumberToWords( @Number % 1000000000000000)
WHEN @Number BETWEEN 1000000000000000000 AND 999999999999999999999
THEN (dbo.fnNumberToWords( @Number / 1000000000000000000))+' Quintillion '+
dbo.fnNumberToWords( @Number % 1000000000000000000)
ELSE ' INVALID INPUT' END
)
SELECT @English = RTRIM(@English)
SELECT @English = RTRIM(LEFT(@English,len(@English)-1))
WHERE RIGHT(@English,1)='-'
RETURN (@English)
END
GO
Test Queries.....
SELECT NumberInEnglish=dbo.fnNumberToWords ( 18)
SELECT NumberInEnglish=dbo.fnNumberToWords ( 67)
SELECT NumberInEnglish=dbo.fnNumberToWords ( 947)
-- Nine Hundred Forty-Seven
SELECT NumberInEnglish=dbo.fnNumberToWords ( 984261)
-- Nine Hundred Eighty-Four Thousand Two Hundred Sixty-One
SELECT NumberInEnglish=dbo.fnNumberToWords ( 777999888)
/* Seven Hundred Seventy-Seven Million Nine Hundred Ninety-Nine Thousand
Eight Hundred Eighty-Eight */
SELECT NumberInEnglish=dbo.fnNumberToWords ( 222777999888)
SELECT NumberInEnglish=dbo.fnNumberToWords ( 555222777999888)
SELECT NumberInEnglish=dbo.fnNumberToWords ( 7446744073709551616)
Source From : http://www.sqlusa.com/bestpractices2008/number-to-words/
http://stackoverflow.com/questions/14486108/converting-any-number-in-words
Subscribe to:
Posts (Atom)





