Netscape CSS problem

Discussion in 'HTML' started by Robert Mark Bram, Jul 26, 2003.

  1. Howdy all!

    I have built a page that uses CSS in such a way that rolling mouse over the
    link should hide and display a red box with Hello World in it.. it works in
    IE but not in Netscape. Can anyone tell me why? I don't think it is the
    JavaScript - Netscape isn't displaying the layer as red.. nor is it
    displaying it in the correct position...

    Any help would be most appreciated!

    Rob
    :)


    <html>
    <head>
    <title>Listing 12.1</title>
    <style type="text/css">
    <!--
    #layer
    {
    background-color:red;
    height:100px;
    left:10px;
    position:absolute;
    top:50px;
    width:100px;
    visibility:hidden;
    }
    -->
    </style>

    <script type="text/javascript">

    function changeState (layerName, state)
    {
    var blockElement = document.getElementById(layerName);
    blockElement.style.visibility = state;
    } // end changeState function

    </script>
    </head>
    <body onLoad="obtainInfo();">
    <div name="layer" id="layer">
    Hello World!
    </div>
    <p>
    <a href="javascript:void(0)"
    onMouseOut="changeState('layer','hidden')"
    onMouseOver="changeState('layer','visible')">
    Rollover to show and hide the layer. :)
    </a>
    </p>
    </body>
    </html>
    Robert Mark Bram, Jul 26, 2003
    #1
    1. Advertising

  2. Howdy - thanks for the effort you have taken.

    Can you please double check this page to see if it works (I uploaded the
    javascript too).

    http://home.connexus.net.au/~bramay/Listing12.1.html

    Is there a setting in Netscape that might be preventing CSS from working
    correctly? I still cannot view a red layer in Netscape from this page and it
    is most frustrating!

    Rob
    :)
    Robert Mark Bram, Jul 27, 2003
    #2
    1. Advertising

  3. Robert Mark Bram pounced upon this pigeonhole and pronounced:
    > Howdy - thanks for the effort you have taken.
    >
    > Can you please double check this page to see if it works (I uploaded the
    > javascript too).
    >
    > http://home.connexus.net.au/~bramay/Listing12.1.html
    >
    > Is there a setting in Netscape that might be preventing CSS from working
    > correctly? I still cannot view a red layer in Netscape from this page and it
    > is most frustrating!


    Nothing happens in my browser because JavaScript is turned off. Why don't
    you use CSS hover to do what you want?

    --
    -bts
    -This space intentionally left blank.
    Beauregard T. Shagnasty, Jul 27, 2003
    #3
  4. Robert Mark Bram

    DU Guest

    Robert Mark Bram wrote:
    > Howdy - thanks for the effort you have taken.
    >
    > Can you please double check this page to see if it works (I uploaded the
    > javascript too).
    >
    > http://home.connexus.net.au/~bramay/Listing12.1.html
    >
    > Is there a setting in Netscape that might be preventing CSS from working
    > correctly? I still cannot view a red layer in Netscape from this page and it
    > is most frustrating!
    >
    > Rob
    > :)
    >
    >


    I can't find the source of the error at your page... but interestingly,
    Mozilla reported a security error... which I should have saved instead
    of disposing of it..

    Try my pages:

    http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/Listing12_1.html
    Basically, your a href code

    http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/Listing12_1_1.html
    with a p:hover code.

    Both files work without a problem in NS 7.1, Mozilla 1.4, MSIE 6 for
    Windows and Opera 7.20 beta2 (build 3014) and both files have minor
    changes from your own page.

    Interactive demo on CSS positioning:
    http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/Positioning.html

    Again, I strongly recommend you drop the "javascript:" pseudo-protocol
    in href value (I'm not explaining, expliciting why here... sorry). A
    link should be a link with valid href value, otherwise you mislead both
    the browsers' code, the browsers' functionalities and the users. In the
    past, there was an excellent discussion on these issues in alt.html and
    often this is repeated in comp.lang.javascript newsgroup. J. Nielsen
    also demonstrate well why this should be.

    Also, people have a tendency to give the same attribute name value to an
    id attribute value when they can and I think this is a bad idea, a
    non-recommendable coding practice. Giving distinct, unique values help
    debugging, reviewing by others, helps getting assistance with debuggers,
    etc..

    In any case, your div should not have a name attribute. Validating your
    markup is best.

    Finally, I checked your obtainInfo code (browser detect) and I also do
    not recommend this way of detecting browsers for many reasons I won't
    detail:
    - many browsers allow users to modify the user agent string
    - from versions to versions, browsers have different support for object
    properties, methods, etc..
    I think you should upgrade your openWindow code and avoid eval() calls
    always and everywhere in your functions.

    DU
    --
    Javascript and Browser bugs:
    http://www10.brinkster.com/doctorunclear/
    DU, Jul 27, 2003
    #4
  5. Robert Mark Bram

    David Graham Guest

    "Robert Mark Bram" <> wrote in message
    news:3f2339cf$0$1210$...
    > Howdy - thanks for the effort you have taken.
    >
    > Can you please double check this page to see if it works (I uploaded the
    > javascript too).
    >
    > http://home.connexus.net.au/~bramay/Listing12.1.html
    >
    > Is there a setting in Netscape that might be preventing CSS from working
    > correctly? I still cannot view a red layer in Netscape from this page and

    it
    > is most frustrating!
    >
    > Rob
    > :)

    Hi
    It worked in my NN7.01 when I saved the file locally on my PC but not when I
    try it over the internet from your site. Perhaps someone in this group will
    know why.
    bye
    David
    David Graham, Jul 27, 2003
    #5
  6. Robert Mark Bram, Jul 27, 2003
    #6
  7. Robert Mark Bram pounced upon this pigeonhole and pronounced:
    > Howdy BTS!
    >
    > > Nothing happens in my browser because JavaScript is turned off. Why don't
    > > you use CSS hover to do what you want?

    >
    > I am writing a course on JavaScript.. :)
    >
    > Rob
    > :)


    Oh then, by all means, move forward! <g>

    JavaScript does have its place, I suppose. Just be sure the students know
    not to use it for anything critical to the operation of the pages.

    --
    -bts
    -This space intentionally left blank.
    Beauregard T. Shagnasty, Jul 27, 2003
    #7
  8. Robert Mark Bram

    DU Guest

    Robert Mark Bram wrote:

    > Howdy DU!
    >
    >
    >>I can't find the source of the error at your page... but interestingly,

    >
    >
    > The error was the html comment within the style tag!
    >
    >
    >>Mozilla reported a security error... which I should have saved instead
    >>of disposing of it..

    >
    >
    > Possibly the sniffing code.. or the eval() call?
    >
    >
    > http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/Listing12_1.html
    >
    >>Basically, your a href code

    >
    >
    > Thank you - that helped me spot what was wrong.
    >
    >
    > http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/Listing12_1_1.htm
    > l
    >
    >>with a p:hover code.

    >
    >
    > That is a nice effect.
    >
    >
    >>Interactive demo on CSS positioning:
    >>

    >
    > http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/Positioning.html
    >
    > Impressive and complex example - I will study this one..
    >
    >
    >>Again, I strongly recommend you drop the "javascript:" pseudo-protocol
    >>in href value (I'm not explaining, expliciting why here... sorry).

    >
    >
    > Yeah, I am aware of the misuse of the status bar with an effect like this. I
    > might make use of a style sheet instead to give the text a "link" look,
    > rather than a void JavaScript HREF.
    >
    >


    No, it's much more than the statusbar. It's right-click context menu,
    the link properties, the opening in another tab no longer possible, in
    another new window instance no longer possible, the View/Page Info/Links
    tab in Mozilla-based browsers become unreliable, etc... The
    "javascript:" pseudo-protocol pretty much fools the browsers, other user
    agents and misleads/confuses/defeats browser functionalities. It's not
    reliable. You can't call DOM methods on it since it's not a valid
    protocol for an href, etc,etc.. J. Nielsen and others pretty much
    explained why it's bad.

    Top Ten Web-Design Mistakes of 2002
    6. JavaScript in Links:
    "Links that don't behave as expected undermine users' understanding of
    their own system. A link should be a simple hypertext reference that
    replaces the current page with new content. (...) link is not a piece of
    code that interferes with the browser's standard behavior."
    http://www.useit.com/alertbox/20021223.html

    The Top Ten New Mistakes of Web Design
    3. Non-Standard Use of GUI Widgets
    "Interaction consistency is an additional reason it's wrong to open new
    browser windows: the standard result of clicking a link is that the
    destination page replaces the origination page in the same browser
    window. Anything else is a violation of the users' expectations and
    makes them feel insecure in their mastery of the Web."
    http://www.useit.com/alertbox/990530.html


    >>In any case, your div should not have a name attribute. Validating your
    >>markup is best.

    >
    >
    > Good advice. Thanks.
    >
    >
    >>Finally, I checked your obtainInfo code (browser detect) and I also do
    >>not recommend this way of detecting browsers for many reasons I won't
    >>detail:
    >>- many browsers allow users to modify the user agent string

    >
    >
    > I was working from a book example for that - I will work on this a bit more.
    >
    > What a great response.. thank you again!
    >
    > Rob
    > :)
    >
    >


    DU
    --
    Javascript and Browser bugs:
    http://www10.brinkster.com/doctorunclear/
    DU, Jul 27, 2003
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski

    ASP.NET, CSS, and Netscape 7.1

    Nathan Sokalski, Mar 12, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    467
    Nathan Sokalski
    Mar 13, 2006
  2. Tom
    Replies:
    0
    Views:
    486
  3. Mickey Segal
    Replies:
    1
    Views:
    644
    Mickey Segal
    May 21, 2004
  4. Fred Camper
    Replies:
    2
    Views:
    422
    Jukka K. Korpela
    Aug 16, 2003
  5. yaktipper
    Replies:
    10
    Views:
    265
    Richard Cornford
    Jul 10, 2003
Loading...

Share This Page