Tagged: javascript

0

scrollMonitor javascript plugin

The scroll monitor allows you to receive events when elements enter or exit the viewport. It does this using watcher objects, which watch an element and trigger events. Watcher objects also contain information about...

1

Javascript String Prototype Extensions

Most variables in JavaScript represent themselves internally as strings. The String class in JavaScript contains a number of handy methods, but many commonly-used functions which are available in other languages, such as the trim()...

0

Javascript string method prototype ex. Remove(), ReplaceAll(), Trim()

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, “”); }; String.prototype.replaceAll = function(item,replacewith) { var s = this; while (s.indexOf(item) >= 0) s = s.replace(item, replacewith); return s; } String.prototype.remove = function(item) { return this.replaceAll(item, “”);...

0

Javascript: Copy to clipboard with or without flash

function copy_to_clipboard(text) { if(window.clipboardData) { window.clipboardData.setData(‘text’,text); } else { var clipboarddiv=document.getElementById(‘divclipboardswf’); if(clipboarddiv==null) { clipboarddiv=document.createElement(‘div’); clipboarddiv.setAttribute(“name”, “divclipboardswf”); clipboarddiv.setAttribute(“id”, “divclipboardswf”); document.body.appendChild(clipboarddiv); } clipboarddiv.innerHTML='<embed src=”clipboard.swf” FlashVars=”clipboard=’+ encodeURIComponent(text)+'” width=”0″ height=”0″ type=”application/x-shockwave-flash”></embed>’; } alert(‘The text is copied to your...