Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

Trim, Mouse Hover Pointer Functions using JAVASCRIPT

, 11 Feb 2012
Rate this:
Please Sign up or sign in to vote.
Trim, Change button mouse hover pointer Functions using JavaScript

Trim Function

Function: trim
Input : ' Test Trim Function ', ''
Output: 'Test Trim Function'
Example:
trim(document.getElementById(varUB).value, '')
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:Button ID="btnSubmit" runat="server" Text="Submit" OnMouseOver="onMouseOver(this);" OnMouseOut="onMouseOut(this);" />
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)

Share

About the Author

Ramanujam Shankar
Web Developer Mahindra Logisoft Business Solution Limited, Chenn
India India
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web03 | 2.8.140905.1 | Last Updated 11 Feb 2012
Article Copyright 2012 by Ramanujam Shankar
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid