Click here to Skip to main content
15,847,903 members
Articles / Web Development / ASP.NET

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 12.4K   1  
Trim, Change button mouse hover pointer Functions using JavaScript

Trim Function

Function: trim
Input : ' Test Trim Function ', ''
Output: 'Test Trim Function'
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
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnMouseOver="onMouseOver(this);" OnMouseOut="onMouseOut(this);" />
function onMouseOver(btnCntl) { = 'hand';
function onMouseOut(btnCntl1) { = 'default';


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 --