Thursday, August 23, 2007

Remove Space At Beginning Of The String Using Regular Expression (Left Trim)

<html>
<head>
<script language="javascript">
function Right_Trim()
{
var str = document.getElementById('txt1').value;
str = str.replace(/^\s+/g,'');
document.getElementById('txt1').value = str;
document.getElementById('txt1').focus();
}
</script>
</head>
<body>
<input type='text' id='txt1' value='                 Click To Check' />
<input type='button' id='bt1' value='Remove Space At Beginning Of The String' onclick='Right_Trim();' />
</body>
</html>

Wednesday, August 22, 2007

Removing The White Space In The String At The End Using Regular Expression (Right Trim)

<html>
<head>
<script language="javascript">
function Left_Trim()
{
var str = document.getElementById('txt1').value;
alert(str.length);// Alert To Show The Length Of The String Before Removing White Space
str = str.replace(/\s+$/g,'');
alert(str.length); // Alert To Show The Length Of The String After Removing White Space
document.getElementById('txt1').value = str;
document.getElementById('txt1').focus();
}
</script>
</head>
<body>
<input type='text' id='txt1' value='Click To Check ' /> <input type='button' id='bt1' value='Remove Space At End Of The String' onclick='Left_Trim();' />
</body>
</html>


Friday, August 17, 2007

Trap F1 key in IE, ByPass Showing Help Window

Blocking F1 keys using javascript,

<html>
<head>
<script>
function ByPass()
{
var kCode = window.event.keyCode;
       if(kCode == 112)
      {
             alert('F1 Clicked'); // Alter Code As Your Wish
       }
}
</script>
</head>
<body onhelp="return false;" onkeydown="ByPass()">
</body>
</html>


Note: Tested In IE 7

Wednesday, August 15, 2007

60 years of Freedom - Happy Indian Independence Day

Here I Wishing everyone a very Happy Indian Independence Day. 15th August, 1947 was the day India got her Independence from the British. And here we are 60 years hence, making good progress on the long winding road to success.

Listen Vande Mataram Online


Indian Flag

Saturday, August 11, 2007

Decide Which Certification Is Right for You

If You are decided to Write Exam, Then Choose Which Certification Is Suit For Your Career


Img Not Yet Loaded Try This Link:http://www.microsoft.com/learning/mcp/sixsteps.mspx

Courtesy Microsoft

Setting Up | Changing the default browser used in VS 2005

Step 1: Open a WebForm .aspx file in .NET IDE.

Setp 2: Select the "Browse With..." option from the File menu.

Or

1) Right click on a .aspx page in your solution explorer

2) Select the "browse with" context menu option


Step 2.1
:Browser Dialog Will displayed in screen.

Step 2.2:Click Add Button From the Browser Dialog.

Step 3:In the Add Dialog, Two think have to mention,Program name and friendly name.

Step 3.1: In Program name, have to give the Full Path Of the Browser.
For Example:
Opera :"C:\Program Files\Opera\Opera.exe".
FireFox:"C:\Program Files\Firefox\firefox.exe".
Step 3.2:Friendly Name, You can give any name as your wish.

Step 4:Select your preferred browser from the list and click the "Set as Default" button.

Friday, August 10, 2007

JavaScript Program To Display Date and Current Time

<html>
<head>
<script type="text/javascript">
function TickTick()
{
var today=new Date()
var dd = today.getDate();
var mm = today.getMonth();
var yy = today.getFullYear();
var h=today.getHours()
var m=today.getMinutes()
var s=today.getSeconds()
m=secTicker(m)
s=secTicker(s)

document.getElementById('Clock').innerHTML="<strong>"+dd+"-"+mm+"-"+yy+" (dd/mm/yyyy)<br/>"+h+":"+m+":"+s+"</strong>";
t=setTimeout('TickTick()',1000)


}

function secTicker(i)// This Function is to add zero before minutes and second value which is less than 10
{
if (i < 10){i = "0" + i}return i; }
</script>
</head>

<body onload="TickTick()">
<div id="Clock"></div>

</body>
</html>

OutPut

Thursday, August 9, 2007

Date() Object In JavaScript

Dates and times creates a series of special problems to the computer programming particularly Web programmer who has to supply web Content to a global audience. For Example:Some countries present the date as dd/mm/yy while others use mm/dd/yy.

In JavaScript Date Object is a part of the overall specification of JavaScript and is available to any page that can include JavaScript,you create a new date object instance by creating a variable as follows: dtObj = new Date( );

The Date( ) object doesn't have properties that can be directly read and written. Instead it has methods that are used to work with the data value in the object.



Program:

<html>
<head>
<title>Date Object In JavaScript</title>
</head>
<body>
<script language="javascript">
dtObj = new Date();

document.write
("Return the day of the month "+"("+dtObj.getDate( )+")"+".<br/><br/>");

// O/P Will Be == > Return the day of the month 9

document.write
("Return the day of the week "+"("+dtObj.getDay( )+")"+ ".<br/><br/>");

// O/P Will Be == > Return the day of the week 4.

document.write
("Return the four digit year "+"("+dtObj.getFullYear( )+")"+ ".<br/><br/>");

// O/P Will Be == > Return the four digit year 2007.

document.write
("Return the hours "+"("+dtObj.getHours( )+")"+ ".<br/><br/>");

// O/P Will Be == > Return the hours 18.

document.write
("Return the milliseconds "+"("+dtObj.getMilliseconds( )+")"+ ".<br/><br/>");

// O/P Will Be == > Return the milliseconds 125.

document.write
("Return the minutes "+"("+dtObj.getMinutes( )+")"+ ".<br/><br/>");

// O/P Will Be == > Return the minutes 29.

document.write
("Return the month "+"("+dtObj.getMonth( )+")" + ".<br/><br/>");

// O/P Will Be == > Return the month 7.

document.write
("Return the seconds "+"("+dtObj.getSeconds( )+")" + ".<br/><br/>");

// O/P Will Be == > Return the seconds 17

document.write
("Return the internal representation of the time "+"("+dtObj.getTime( )
+")"+ ".<br/><br/>");

// O/P Will Be == > Return the internal representation of the time 1186664357125.

document.write
("Return the offset from GMT "+"("+dtObj.getTimezoneOffset( ) +")"+ ".<br/><br/>");

// O/P Will Be == > Return the offset from GMT -330.

document.write
("Return the Universal Time day of the month "+"("+dtObj.getUTCDate( )+")" + ".<br/><br/>");

// O/P Will Be == > Return the Universal Time day of the month 9.

document.write
("Return the Universal Time day of the week "+"("+dtObj.getUTCDay( )+")"+ ".<br/><br/>");

// O/P Will Be == > Return the Universal Time day of the week 4.

document.write
("Return the Universal Time four digit year "+"("+dtObj.getUTCFullYear( )+")" + ".<br/><br/>");

// O/P Will Be == > Return the Universal Time four digit year 2007.

document.write
("Return the Universal Time hours "+"("+dtObj.getUTCHours( )+")" + ".<br/><br/>");

// O/P Will Be == > Return the Universal Time hours 12.

document.write
("Return the Universal Time milliseconds "+"("+dtObj.getUTCMilliseconds( )+")" + ".<br/><br/>");

// O/P Will Be == > Return the Universal Time milliseconds 125.

document.write
("Return the Universal Time minutes "+"("+dtObj.getUTCMinutes( ) +")"+ ".<br/><br/>");

// O/P Will Be == > Return the Universal Time minutes 59.

document.write
("Return the Universal Time month "+"("+dtObj.getUTCMonth( )+")"+ ".<br/><br/>");

// O/P Will Be == > Return the Universal Time month 7.

document.write
("Return the Universal Time seconds "+"("+dtObj.getUTCSeconds( )+")"+".<br/><br/>");

// O/P Will Be == > Return the Universal Time seconds 17.

document.write
("The time and date at Your computer's location "+"("+dtObj.toLocaleString()+")" + ".<br/><br/>");

//The time and date at Your computer's location Thursday, August 09, 2007 6:29:17 PM.

document.write
("The time zone offset B/W local time and GMT is "+"("+dtObj.getTimezoneOffset()+")" + " minutes.<br/><br/>");

//The time zone offset B/W local time and GMT is -330 minutes.

document.write
("The time and date (GMT) is: "+"("+dtObj.toGMTString()+")" + ".<br/><br/>");

//The time and date (GMT) is: Thu, 9 Aug 2007 12:59:17 UTC.

</script>
</body>
</html>

Note: Output In Coment Line are which i got as result when i Compiled in My System,
so date and time will change according your system time and day.

Sunday, August 5, 2007

Dynamically Increase The Size Of The TextBox Using JavaScript

<html>
<head>
<script>
function incr()
{
var len = document.getElementById('txt').value;
document.getElementById('txt').style.width = 75+len.length*4+'px';
}
</script>
<body>
<input type='text' id='txt' onkeydown='incr()' style='width:75px' />
</body>
</html>


Friday, August 3, 2007

Remove White Space In String Using Regular Expression in JavaScript

<html>
<head>
<script language="javascript">
function rmWhiteSpace()
{


var str = document.getElementById('txt1').value;

str = str.replace(/\s+/g,'');

document.getElementById('txt1').value = str;

// \s+ Description
// + 1 or more of previous expression.
// \s Matches any white-space character.
// Equivalent to the Unicode character categories [\f\n\r\t\v\x85\p{Z}].
// If ECMAScript-compliant behavior is specified with the ECMAScript option,
// \s is equivalent to [ \f\n\r\t\v].
}
</script>
</head>
<body>
<input type='text' id='txt1' value=' Click To Check' /> <input type='button' id='bt1' value='Remove White Space' onclick='rmWhiteSpace();' />
</body>
</html>


Program Demo

OutPut