javascript Programming Glossary: document.body
How to get height of entire document with JavaScript? http://stackoverflow.com/questions/1145850/how-to-get-height-of-entire-document-with-javascript .height returns correct value document.height returns 0 document.body.scrollHeight returns 0 On Paperback Swap jQuery's document .height.. is null document.height returns an incorrect value document.body.scrollHeight returns an incorrect value Note I have browser.. highest one. This is basically what jQuery does var body document.body html document.documentElement var height Math.max body.scrollHeight..
Modifying document.location.hash without page scrolling http://stackoverflow.com/questions/1489624/modifying-document-location-hash-without-page-scrolling top document .scrollTop 'px' .attr 'id' hash .appendTo document.body document.location.hash hash if node.length fx.remove node.attr..
How can I use jQuery to style /parts/ of all instances of a specific word? http://stackoverflow.com/questions/1501007/how-can-i-use-jquery-to-style-parts-of-all-instances-of-a-specific-word i 0 callback.call window child matches i findText document.body bBuyNow b g function node match var span document.createElement..
How to detect page zoom level in all modern browsers? http://stackoverflow.com/questions/1713771/how-to-detect-page-zoom-level-in-all-modern-browsers zoom screen.systemXDPI screen.logicalXDPI IE7 var body document.body r body.getBoundingClientRect return r.left r.right body.offsetWidth..
Select a complete table with javascript (to be copied to clipboard) http://stackoverflow.com/questions/2044616/select-a-complete-table-with-javascript-to-be-copied-to-clipboard text javascript function selectElementContents el var body document.body range sel if document.createRange window.getSelection range..
jQuery .ready in a dynamically inserted iframe http://stackoverflow.com/questions/205087/jquery-ready-in-a-dynamically-inserted-iframe with the following code function callIframe url callback document.body .append ' IFRAME id myId ... ' 'iframe#myId' .attr 'src' url..
Injecting JS functions into the page from a Greasemonkey script on Chrome http://stackoverflow.com/questions/2303147/injecting-js-functions-into-the-page-from-a-greasemonkey-script-on-chrome script.appendChild document.createTextNode ' ' main ' ' document.body document.head document.documentElement .appendChild script ..
getElementsByTagName() equivalent for textNodes http://stackoverflow.com/questions/2579666/getelementsbytagname-equivalent-for-textnodes nativeTreeWalker var walker document.createTreeWalker document.body NodeFilter.SHOW_TEXT null false var node var textNodes while.. result.push child.nodeValue else findTextNodes child document.body Iterative Tree Traversal function customIterativeTreeWalker.. function customIterativeTreeWalker var result var root document.body var node root.childNodes 0 while node null if node.nodeType..
Way to know if user clicked Cancel on a Javascript onbeforeunload Dialog? http://stackoverflow.com/questions/4650692/way-to-know-if-user-clicked-cancel-on-a-javascript-onbeforeunload-dialog function setTimeout function setTimeout function document.body .css 'background color' 'red' 1000 1 return 'are you sure'..
Chrome sendrequest error: TypeError: Converting circular structure to JSON http://stackoverflow.com/questions/4816099/chrome-sendrequest-error-typeerror-converting-circular-structure-to-json document has a reference to the DOM tree at least through document.body and document.body.ownerDocument refers back to document again.. to the DOM tree at least through document.body and document.body.ownerDocument refers back to document again which is only one..
Full text search in HTML ignoring tags / & http://stackoverflow.com/questions/5886858/full-text-search-in-html-ignoring-tags on var sel window.getSelection sel.collapse document.body 0 while window.find text document.execCommand HiliteColor false.. yellow sel.collapseToEnd document.designMode off else if document.body.createTextRange var textRange document.body.createTextRange.. off else if document.body.createTextRange var textRange document.body.createTextRange while textRange.findText text textRange.execCommand..
javascript document.getElementsByClassName compatibility with IE http://stackoverflow.com/questions/7410949/javascript-document-getelementsbyclassname-compatibility-with-ie els i return a var tabs document.getElementsByClassName document.body 'tab' ...but IE still says Object doesn't support this property.. a.push els i return a var tabs getElementsByClassName document.body 'tab' ...Also if you only need IE8 support then this will work..
DOM Mutation event in JQuery or vanilla Javascript http://stackoverflow.com/questions/7692730/dom-mutation-event-in-jquery-or-vanilla-javascript var DOMwatcher function root callback var __appendChild document.body.appendChild var patch function node if typeof node.appendChild.. while i patch node.childNodes i patch root DOMwatcher document.body function targetElement newElement alert 'append detected' '#container..
Turning live() into on() in jQuery http://stackoverflow.com/questions/8021436/turning-live-into-on-in-jquery call to .on . Equivalent to .live would be something like document.body .on 'change' 'select name^ income_type_ ' function alert this..
How to make an ajax call without jquery? http://stackoverflow.com/questions/8567114/how-to-make-an-ajax-call-without-jquery script With jQuery .ajax url test.html context document.body success function this .addClass done share improve this answer..
how to bind fancybox to dynamic added element? http://stackoverflow.com/questions/9081571/how-to-bind-fancybox-to-dynamic-added-element like this first i append a element to body use jquery document.body .append a href home index class fancybox and i call fancybox..
|