The JavaScript prototype functions in this JavaScript article tutorial are collected by jsB@nk from many JavaScript resources on the Internet. These JavaScript prototype functions are very helpful and essential to your JavaScript applications, web-based applications if you need to reduce time and work to process JavaScript tasks. And if you are still not good at JavaScript prototype functions, please read the JavaScript article below:
- JavaScript Prototype: Some Basic Concepts
- Prototype Dollar Function
This JavaScript article tutorial provides you the JavaScript source codes of 13 JavaScript prototype functions to process JavaScript Strings, JavaScript Arrays and Number variables, please go to the full-post page for details, now jsB@nk shows you some very popular JavaScript prototype functions only:
- contains: check if a string contains a child string
- trim: strips all redundant spaces from beginning and end of string
- copy: copy/clone an array variable
- random: return a random element, optionally up to or from range
A simple JavaScript function to give web developers, web coders, web programmers ability for get HTML elements by their className properties.
This JavaScript code example will dynamically add/remove HTML elements with content included within them according to the DOM2 specification. A very easy JavaScript code to learn and use DOM.
Try more JavaScript codes on jsB@nk to handle DOM better:
- JavaScript OOP with Input Display Toggle
- JavaScript Content Auto-Indexing using DOM
- JavaScript Add More Unlimited Input Fields
This free JavaScript snippet guides you how to remove an element in JavaScript array, by the value of element or its index. Very useful and helpful for coding and programming in JavaScript. Indexes in this JavaScript snippet:
- Remove Array element by Index, with splice()
method.
- Remove Array element by Value
JavaScript language does not provide us a function for obtaining elements by class, only by id, name, and tag name. This JavaScript snippet will accomplish that, and includes optional arguments with defaults and support for multiple classnames in any order. It works in Internet Explorer, Firefox, Opera, Safari and Mac.
If your visitor is using Internet Explorer as their browser, this script will politely suggest Firefox as an alternative browser, maybe your users will remove IE like you; it is not windows notification, browser alert only. Just add it to the head of your page. Very simple!
This browser sniffer detects all the major browsers currently out there, and passes the results on as variables to facilitate your browser detection needs. It differentiates between Windows, Mac and Linux, and the most commonly used DHTML browsers - IE4/5/6, Netscape 4/6/7/other Gecko, Konqueror 2.2+, Safari, Opera 5/6/7. All other browsers are grouped together under a single exclude variable, to protect them from complex scripting.
Let use this simple JavaScript if you want to use the DOM to include a cascading style sheet. Very simple to implement and customize.
This function script will return an array of tags based on DOM element, tag, and class name. For example, getElementsByClassName(document, 'tr', 'info')
will return to you an array of all "tr
" tags under the document node having the "info
" class.