15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

400<br />

<strong>JavaScript</strong> <strong>Examples</strong> <strong>Bible</strong>: The Essential Companion to <strong>JavaScript</strong> <strong>Bible</strong><br />

navigator.appCodeName<br />

Listing 28-1 (continued)<br />

function isGeneration3() {<br />

return (parseInt(navigator.appVersion) == 3)<br />

}<br />

function isGeneration3Min() {<br />

return (parseInt(navigator.appVersion.charAt(0)) >= 3)<br />

}<br />

function isNav4_7() {<br />

return (isNav() && parseFloat(navigator.appVersion) == 4.7)<br />

}<br />

function isMSIE4Min() {<br />

return (isIE() && navigator.appVersion.indexOf(“MSIE”) != -1)<br />

}<br />

function isMSIE5_5() {<br />

return (navigator.appVersion.indexOf(“MSIE 5.5”) != -1)<br />

}<br />

function isNN6Min() {<br />

return (isNav() && parseInt(navigator.appVersion) >= 5)<br />

}<br />

// element referencing syntax<br />

function isDocAll() {<br />

return (document.all) ? true : false<br />

}<br />

function isDocW3C() {<br />

return (document.getElementById) ? true : false<br />

}<br />

// fill in the blanks<br />

function checkBrowser() {<br />

var form = document.forms[0]<br />

form.brandNN.value = isNav()<br />

form.brandIE.value = isIE()<br />

form.win.value = isWindows()<br />

form.win32.value = isWin95NT()<br />

form.mac.value = isMac()<br />

form.ppc.value = isMacPPC()<br />

form.unix.value = isUnix()<br />

form.ver3Only.value = isGeneration3()<br />

form.ver3Up.value = isGeneration3Min()<br />

form.Nav4_7.value = isNav4_7()<br />

form.Nav6Up.value = isNN6Min()<br />

form.MSIE4.value = isMSIE4Min()<br />

form.MSIE5_5.value = isMSIE5_5()

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!