Skip to content

Puppy Chau

Things I know I'll forget sooner or later…

  • Home
  • About
  • Tools
  • Twitter
  • LinkedIn

Category: Programming Language

Adding Trim functions to Javascript String Prototype

Some times, a little RegExp is a beautiful thing…

String.prototype.trim = function() {
  return this.replace(/^\s+|\s+$/g, "");
}

String.prototype.lTrim = function() {
  return this.replace(/^\s+/, "");
}

String.prototype.rTrim = function() {
  return this.replace(/\s+$/, "");
}
Author HowardPosted on 2010-08-28Categories JavascriptLeave a comment on Adding Trim functions to Javascript String Prototype

Javascript Resize Browser Window to Full Screen

This is not quite the same as maximizing the browser window. It just resizes the browser window to the total width and total height of the screen.

<script type="text/javascript">//<![CDATA[
function maximize() {
  window.moveTo(0, 0);
  window.resizeTo(screen.width, screen.height);
}

maximize();
//]]></script>
Author HowardPosted on 2010-08-282010-08-28Categories JavascriptLeave a comment on Javascript Resize Browser Window to Full Screen

Posts pagination

Previous page Page 1 Page 2

Recent Posts

  • Manually Install JDK on Linux
  • XDG User Directories
  • lightDM hide user list / disable guest login
  • Showing Seconds in Windows Taskbar Clock
  • Install .NET Core SDK on elementary OS

Recent Comments

  • GNU Emacs error on elementary OS – Puppy Chau on Adding Desktop Entries to System
  • Howard on Reduce Applications Icon Size in GNOME Shell
  • Benoit Chalvignac on Reduce Applications Icon Size in GNOME Shell

Archives

Categories

  • Home
  • About
  • Tools
  • Twitter
  • LinkedIn
Puppy Chau Proudly powered by WordPress
pixel