To maximize the browser window to fit the screen, we first move the window to the top left corner and then set its size to the size of the client’s desktop:
How to go back one page in the browser history using JavaScript
Using JavaScript you can go back or forward in the browser’s navigation history. Most of the time you want to go back one page by clicking a link in the page. For doing that, use the following code: <a href=”javascript:history.go(-1)”>Go back</a> It’s easy to figure out that to go back more pages in history, you […]
Validating credit card numbers
This JavaScript function checks a text field for a valid credit card number through several validation methods.
Strip HTML using JavaScript
A simple function that uses regular expressions to strip the HTML tags out of strings.
Add to favorites/bookmarks in Internet Explorer and Firefox
With only a few JavaScript lines you can initiate the dialog for “Add to Favorites” dialog in Internet Explorer and the “Add to Bookmarks” dialog in Firefox, as shown in this example.
Check / uncheck all checkboxes in a form
One easy JavaScript function that will check or uncheck all the checkboxes in a form that’s being passed as the first argument to the function.
Validate phone number using RegEx and JavaScript
A function to validate phone numbers using JavaScript and regular expressions. It will work with all valid US phone numbers in all popular formats.
Swap string case using JavaScript
The SwapCase function turns lowercase characters into uppercase and uppercase characters into lowercase.
Get Real Angle Value
Given a large angle, or a negative angle, a number equal to 0 or bigger, and smaller than 360 is returned.
Introducing operators
You’ll get familiar with JavaScript’s operators. Assignment operators, arithmetic operators, comparison operators, logical and conditional operators… This is another chapter of my old, unfinished book, ‘JavaScript Class’. You’ll get familiar with operators really soon, that’s because you already know the basics of them. Yes, you do. You learned about them in your first years of […]