This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Randomize array element order in-place. | |
* Using Fisher-Yates shuffle algorithm. | |
*/ | |
Array.prototype.shuffle = function () { | |
for (var i = this.length - 1; i > 0; i--) { | |
var j = Math.floor(Math.random() * (i + 1)); | |
var temp = this[i]; | |
this[i] = this[j]; | |
this[j] = temp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns an array of elements | |
// the argument attr (attribute) is reuqired, the argument val (value) is optional: | |
// - if val passed then only elements where the attribute attr == val will be returned | |
// - otherise, all element with the attribute attr will be retured | |
document.getElementsByAttribute = Element.prototype.getElementsByAttribute = function(attr, val) { | |
var nodeList = this.getElementsByTagName('*'); | |
var nodeArray = []; | |
for (var i = 0, elem; elem = nodeList[i]; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<!-- We will set the default scripting language to VBScript. --> | |
<meta http-equiv="Content-Script-Type" content="text/vbscript" /> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> | |
<title>Stating the language used in scripts</title> |