Click here to Skip to main content
15,440,991 members
Articles / Web Development / ASP.NET
Tip/Trick
Posted 11 Feb 2012

Tagged as

Stats

11.9K views
1 bookmarked

Trim, Mouse Hover Pointer Functions using JAVASCRIPT

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
11 Feb 2012CPOL
Trim, Change button mouse hover pointer Functions using JavaScript

Trim Function


Function: trim
Input : ' Test Trim Function ', ''
Output: 'Test Trim Function'
Example:
JavaScript
trim(document.getElementById(varUB).value, '')

JavaScript
function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}
function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}


Change Button Mouse Hover Pointer


Input: Button control client id
Example:
ASP.NET
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnMouseOver="onMouseOver(this);" OnMouseOut="onMouseOut(this);" />
JavaScript
function onMouseOver(btnCntl) {
    btnCntl.style.cursor = 'hand';
}
function onMouseOut(btnCntl1) {
    btnCntl1.style.cursor = 'default';
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer Mahindra Logisoft Business Solution Limited, Chenn
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --