How To Add Trim Functionality To Javascript StringAugust 12th, 2007 Trim is a useful function available in languages like Java & PHP which removes the leading and traling whitespace(s) from a String. Unfortunately Javascript doesn't natively provide trim functionality to the String object.
Program (Source Code) to Trim Whitespaces from Files...April 20th, 2008 PHP is not only a very competent web development language (and part of LAMP stack). It is also a very capable language for writing (command line) scripts.
How To Compress JavaScript Files SafelyJuly 4th, 2006 List of high quality javascript compressors. Feel free to add to this list in your comments.
Developing Clean AJAX / Javascript Driven Websites; Say No To Tag-SoupNovember 13th, 2005 Behaviour promotes itself as "the missing link for your AJAX apps". It allows you to use CSS selectors (like id or class) to apply Javascript behaviors to your HTML elements.
Little Painful Javascript QuirkMay 14th, 2006 Why doesn't document.getElementById('location').value work as function parameter in Javascript?
What does work is:
var temp = document.getElementById('location');
temp.value works fine as function parameter. Apparently javascript doesn't like referencing fields directly on functions as in getElementById('location').value as a function parameter.
Biggest Internet Explorer Problem With JavascriptJuly 26th, 2007 You would be surprised to know that the biggest Internet Explorer issue I am facing while writing rather complex cross-browser javascript code is related to just a comma. In javascript array if you add a comma after the last element in the array then Internet Explorer fails with a variety of undecipherable (Microsoft style) error messages.
Angsuman's WordPress 2.0 / 1.5.x Dashboard Replacement: How to Trim The Fat Resource Hogging WordPress Admin DashboardDecember 27th, 2005 WordPress developers are adding their preferred feeds to WordPress Admin Dashboard (from WordPress 1.5 onwards), which significantly slows up loading the Admin Dashboard. Additionally few essential information has been removed frfom the official version of admin dashboard and also some information moved to hard-to-get locations in order to accomodate their copious feed data.
How To Use SAJAX (AJAX Framework) from HTMLMay 15th, 2006 Sajax is an useful ajax framework to simplify ajax based development for languages like PHP, Ruby etc. Not many realize Sajax can be used equally well from plain old html pages (as in .html or .htm).
WordPress 2.0 & 1.5.x Hack: How to trim the fat resource hogging Admin DashBoard (Version 2)April 18th, 2005 Drop in replacement for resource hogging Admin DashBoard in WordPress 2.0, 1.5.x
Yahoo UI Library (JavaScript + AJAX) is Worth LookingFebruary 17th, 2006 Yahoo released an UI library for web applications, developed using Javascript and AJAX. It provides some nifty components like dual-calendar, tree, drag-and-drop, slidedrs etc.
How To Enable window.status in FirefoxMay 14th, 2006 Strangely you cannot set browser window status bar using javascript (by setting window.status) in Firefox. There are two simple ways you can enable it.
How To Add Functions To Javascript onload Over Third Party Scripts; Playing NiceFebruary 7th, 2007 As a javascript developer using onload often you will find that other script authors too love to use onload. Unfortunately onload accepts a function name and your reassigning will prevent others from using onload.
How To Detect AdBlock PlusNovember 12th, 2007 AdBlock Plus is a controversial Firefox plugin to prevent ads from displaying on web pages. There is a simple procedure to detect (and take appropriate action) AdBlock Plus.
Tracking Outbound Clicks With Google AnalyticsNovember 18th, 2005 This piece of JavaScript assigns a pageview to any click on a link - the pageview is attributed to the filename you specify. For example, to log every click on a particular link to www.example.com as a pageview for "/outgoing/example_com" you would add the following attribute to the link's <a> tag:
<a href="http://www.example.com" onClick="javascript:urchinTracker ('/outgoing/example_com');">
It is a good idea to log all of your outbound links into a logical directory structure as shown in the example.
WordPress 2.0/1.5.x Hack: How to trim the fat resource hogging Admin DashBoardMarch 19th, 2005 Drop in replacement for resource hogging Admin DashBoard in WordPress 2.0/1.5.x
January 20th, 2007 at 12:35 am
Hi.. im new to javascript… first of all i want to know whether javascript and jscript is same.. or any other difference… and plz guide me what is the use of trim function…
January 20th, 2007 at 12:36 am
How to validate the forms in javascript…
February 9th, 2007 at 2:46 am
uday plese try to understand yarr, why ur try to javascruipt go to your bad and just sleeping yarr, edighot
July 18th, 2007 at 1:19 pm
// This function is for stripping leading and trailing spacesfunction trim(str) { if (str != null) { var i; for (i=0; i=0; i–) { if (str.charAt(i)!=” “) { str=str.substring(0,i+1); break; } } if (str.charAt(0)==” “) { return “”; } else { return str; } }}
August 1st, 2007 at 11:45 am
this is my comment ok sorry
November 15th, 2007 at 5:57 am
This should actually be as follows:
surname = surname.replace(/^\s+/, “”).replace(/\s+$/, “”);
December 5th, 2007 at 12:42 am
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”), “”);
}
March 31st, 2008 at 4:40 am
To answer this.. Javascript and Jscript are the same meaning with the different versioning. Jscript is the version of Microsoft javascript. Some time the Document Object Model might differ from the Javascript. And Jscript works only on IE browser.
This might answer your question.
http://javascript.about.com/library/bljscript.htm
Thanks for the trim code.
Thanks.
April 5th, 2008 at 8:18 am
i want to search the javascript questions
April 5th, 2008 at 8:22 am
to know the java script books
April 25th, 2008 at 2:16 am
Can also implement a trim function by extending the string type using a prototype. Have a look at http://whadiz.com/c/whatis.aspx/programming/javascript/javascript_trim
May 7th, 2009 at 1:53 pm
i m a tester for this application. take care dears.
September 9th, 2009 at 12:42 am
form.id.value.replace(/\s/g, “”);
check this,
this works absolutely fine in javascript.