Wrox Programmer Forums
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 12th, 2004, 09:12 PM
Authorized User
Join Date: Jun 2003
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can Macintosh load <div>?

The following HTML/javascript document illustrates a question I have with client-side Macintosh users. The <div ID="NavBarDiv"> does not load using any of my IE or NN-compatible commands.

Does Macintosh support an equivalent command?
How do I detect Macintosh users?

On a Macintosh computer, notice that the website www.finehomemadesoap.com does not have a navigation bar, because I generate HTML for the navigation bar, and then load it into the <div> block using the script shown below.

Thanks, Daniel

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <div ID="NavBarDiv" style="position: relative; left: 10px; top: 0 px;">
    Loading...<br><br>Appologies Macintosh users.<br>If wait is longer than 1 second, loading is unsuccessful.

    <script language="JavaScript" type="text/javascript">
        //document.getElementById('NavBarDiv').innerHTML = "Hello hello hello.";
        var navBarHTML = 'Hello.<br>You have successfully written HTML.' ;
        var documentContainingTag = window.document;
        //writeInnerHTML(documentContainingTag,'NavBarDiv',n avBarHTML)
        function writeInnerHTML(documentContainingTag, tagID, HTML) {
            var htmlElement;
            if (document.layers) { // NN4. Layers are supported.
                htmlElement = documentContainingTag.layers[tagID].document;
            } else if (document.all) { // IE4+.
                htmlElement = documentContainingTag.all[tagID];
                htmlElement.innerHTML = HTML;
            } else if (document.documentElement) { // NN6.
                htmlElement = documentContainingTag.getElementById(tagID);
                htmlElement.innerHTML = HTML;


Daniel Hutchins
Woodbridge, CA
Daniel Hutchins
Stockton, CA
Old May 13th, 2004, 10:27 AM
Friend of Wrox
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts

quote:How do I detect Macintosh users?
var o = navigator.platform;
os = "mac";
else if(o.indexOf("Win")!=-1)
os = "win";
else if(o.indexOf("Linux")!=-1)
os = "linux";
os = "other";




Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript with <div> aware Javascript How-To 3 August 25th, 2005 05:57 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
sizeable <div> johnjohn Javascript How-To 1 December 8th, 2004 08:28 PM
scrolling <DIV> anshul Javascript How-To 12 August 4th, 2004 09:51 AM
<A><DIV><TABLE></DIV></A> anshul HTML Code Clinic 2 July 17th, 2004 02:17 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.