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
var img = new Image(); | |
img.src = 'YOUR URL HERE'; | |
img.onload = function(){ | |
//do something when the image loads | |
// for instance, you may shove it in the DOM. | |
var imgDom = document.createElement('IMG'); | |
imgDom.setAttribute('src','YOUR URL HERE'); | |
//some dom element reference - element | |
element.appendChild(imgDom); | |
} |
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
var img = new Image(); | |
img.onload = function(){ | |
//do something when the image loads | |
// for instance, inject in DOM. | |
var imgDom = document.createElement('IMG'); | |
imgDom.setAttribute('src','YOUR URL HERE'); | |
//some dom element reference - element | |
element.appendChild(imgDom); | |
} |
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
var img = document.createElement('IMG'); | |
img.setAttribute('src','YOUR URL HERE'); | |
//some ref to DOM element - element | |
element.appendChild(img); |
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
<div class="list">List 0</div> | |
<div class="list">List 1</div> | |
<div class="list">List 2</div> | |
<div class="list">List 3</div> | |
<div class="list">List 4</div> |
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
1. elements = document.getElementsByClassName(names); // or: | |
2. elements = rootElement.getElementsByClassName(names); |
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
<div class="list">List 1</div> | |
<div class="list">List 2</div> | |
<div class="list">List 3</div> | |
<div class="list">List 0</div> | |
<div class="list">List 4</div> |
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
var img = new Image(); | |
var data = 'name="John"'; | |
img.onload = function(){ | |
console.log('data successfully sent'); | |
} | |
img.src = 'YOUR SCRIPT URL HERE' + '?' + data; |
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
var arrayStore = []; //array to store the responses | |
// callback fn that is to be called after | |
// each JSONP call is successful | |
var callback = function(index,response){ | |
arrayStore[index] = response; | |
}; | |
var position = 0; | |
while( position < 5 ){ |
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
//The curry function that we will use. | |
var _curry = function() { | |
var args = Array.prototype.slice.call(arguments); | |
var fn = args.shift(); | |
return function() { | |
return fn.apply(this, args.concat( | |
Array.prototype.slice.call(arguments))); | |
}; | |
}; |
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
var str = 'posterous'; | |
if ( str.search('t') >= 0 ) { | |
// character t found | |
} | |
else{ | |
// not found | |
} |
OlderNewer