Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 12th, 2004, 09:12 PM
Authorized User
 
Join Date: Jun 2003
Location: Stockton, CA, USA.
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">
<html>
<body>

    <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.
    </div>

    <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;
                htmlElement.open();
                htmlElement.write(HTML);
                htmlElement.close();
            } else if (document.all) { // IE4+.
                htmlElement = documentContainingTag.all[tagID];
                htmlElement.innerHTML = HTML;
            } else if (document.documentElement) { // NN6.
                htmlElement = documentContainingTag.getElementById(tagID);
                htmlElement.innerHTML = HTML;
            }
        }

    </script>
</body>
</html>

Daniel Hutchins
Woodbridge, CA
http://www.finehomemadesoap.com
__________________
Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com
Reply With Quote
  #2 (permalink)  
Old May 13th, 2004, 10:27 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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

HTH,

Snib

<><
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:49 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.