Innerwidth var h

This preview shows page 13 - 23 out of 54 pages.

var w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; var x = document.getElementById("demo"); x.innerHTML = "Browser inner window width: " + w + ", height: " + h + "."; </script> </body> </html>
Image of page 13
JavaScript Browser Object Model (BOM): Navigator <p id="appName"></p> <p id="cookiesEnabled"></p> <p id="appCodeName"></p> <p id="product"></p> <script> document.getElementById("appName").innerHTML = "navigator.appName is " + navigator.appName; // most likely will be Netscape document.getElementById("cookiesEnabled").innerHTML = "cookiesEnabled is " + navigator.cookieEnabled; // true/false document.getElementById("appCodeName").innerHTML = "navigator.appCodeName is " + navigator.appCodeName; // most likely will be Mozilla document.getElementById("demo").innerHTML = "navigator.product is " + navigator.product; // most likely will be Gecko </script>
Image of page 14
JavaScript Detect Browser (from Quora) navigator.sayswho= ( function (){ var ua= navigator.userAgent, tem, M= ua.match( /(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/ i) || []; if ( /trident/ i.test(M[ 1 ])){ tem= /\brv[ :]+(\d+)/ g. exec (ua) || []; return 'IE ' +(tem[ 1 ] || '' ); } if (M[ 1 ]=== 'Chrome' ){ tem= ua.match( /\b(OPR|Edge)\/(\d+)/ ); if (tem!= null ) return tem.slice( 1 ).join( ' ' ).replace( 'OPR' , 'Opera' ); } M= M[ 2 ]? [M[ 1 ], M[ 2 ]]: [navigator.appName, navigator.appVersion, '-?' ]; if ((tem= ua.match( /version\/(\d+)/ i))!= null ) M.splice( 1 , 1 , tem[ 1 ]); return M.join( ' ' ); })();
Image of page 15
jQuery
Image of page 16
What is jQuery? jQuery is a fast, small, and feature-rich JavaScript library Easy-to-use API Client-side HTML scripting Works across many browsers Versatile and extensible Simplifies taks like HTML document traversal and manipulation event handling animation AJAX jQuery has changed the way that millions of people write JavaScript
Image of page 17
More about jQuery Free, open-source software using MIT license Most widely used javascript library Original author John Resign (American, born 1984) First release 2006
Image of page 18
Image of page 19
jQuery.com In addition to core jQuery functionality, jQuery.com also supports other projects jQuery User Interface - developing UI jQuery Mobile - accessible, cross-platform sites and apps QUnit - Javascript-based unit testing Sizzle - CSS selector engine
Image of page 20
Versions of jQuery Current version is 3.3.1 At time of zybook publication, latest version was 2.1.4 Choice of Production and Development versions Production version is for a live website as it is minified and compressed Development version is for testing and development as it is uncompressed and readable Already bundled with Microsoft’s Visual Studio and other frameworks, as well as Nokia’s Web Run-Time widget development platform
Image of page 21
How to include jQuery Download it from jQuery.com and add this to HTML < head > < script src ="jquery-3.3.1.min.js">< /script > < /head > ALT: !< YFXOVZ src "= ±jquery²js± >!<° YFXOVZ > Reference it in from Google or Microsoft CDN < head > < script src ="">< /script > < /head > < head > < script src ="">< /script > < /head > When using 7oogle or =icrosoft 34>± often it will already be downloaded by a previous site± and now sits in the cache± thus providing for faster load times
Image of page 22
Image of page 23

You've reached the end of your free preview.

Want to read all 54 pages?

  • Fall '19
  • Ajax

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes