Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Junsee
    Guest

    Opera Browser - Mouse over issue

    I have some js code (not my own as I am really lacking in java knowledge)

    PHP Code:
    <script>
        function 
    showtarget(which) {
            var 
    spans document.getElementById("MenuDescription").getElementsByTagName("SPAN");
            for ( var 
    0<= spans.length; ++) {
                
    spans[s].style.display = ( == which-1) ? "inline" "none";
            }
        }
    </script> 
    You can see the site here http://www.stokerscoffeelounge.com.a...etpancakes.php
    (Taking the example on Opera Browser, where you hover over Fresh Strawberry and then Spicy Apple)

    Basically on the mouse over of the Menu Items, you find that is displays correctly on all browsers except one. On the Opera Browser, when you hover over Spicy Apple some of the Fresh Strawberry text is left over.

    I don't want to clear the text on mouseout as that would be annoying to people as they would have keep their mouse trained on the menu item while reading the text on the right.

    I need to know how to clear the element before it grabs the next span?

    Much appreciation and thanks for comments, suggestions and fixes.
    Last edited by Junsee; 12-04-2012 at 11:08 AM.

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by Junsee View Post
    I have some js code (not my own as I am really lacking in java knowledge)
    So is the author of that code.


    Code:
    		for ( var s = 0; s <= spans.length; ++s ) {
    Remove the '=' as it causes an addressing error, then see if it changes anything.

  • #3
    New Coder
    Join Date
    Apr 2011
    Posts
    49
    Thanks
    0
    Thanked 13 Times in 12 Posts
    You should validate your HTML aswell.
    Having block-elements inside inline-elements is part of the problem.

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,593
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Quote Originally Posted by Logic Ali View Post
    So is the author of that code.
    Not necessarily - the author of the code may be a Java expert - it is JavaScript knowledge that they are lacking.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by felgall View Post
    Not necessarily - the author of the code may be a Java expert - it is JavaScript knowledge that they are lacking.
    The cause of the error in question would be just a easy to spot (and avoid) by a competent in either language.

  • #6
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,593
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Quote Originally Posted by Logic Ali View Post
    The cause of the error in question would be just a easy to spot (and avoid) by a competent in either language.
    If that is true then why is all of Google's JavaScript code such an antiquated mess. They have a large number of Java experts working for them who would surely recognise that all their JavaScript is garbage if the two languages were similar enough for people working in one to spot errors in the other - particularly such huge errors as are made throughout Google's JavaScript code.

    That surely is evidence that someone can be a Java Expert and know absolutely nothing at all about JavaScript. Or is all of Google's Java code as badly written as their JavaScript?
    Last edited by felgall; 12-05-2012 at 06:36 PM.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #7
    Junsee
    Guest
    PHP Code:
    for ( var 0spans.length; ++) { 
    No that didn't work either, no change on Opera
    and the other broswers (Which still work fine)

    Thanks for all the help



    EDIT: to further add
    When I open DragonFly, Operas Debugging console, the Script works correctly!
    As soon as I close the debugging console it goes back to leaving a shadow.
    Weird
    Last edited by Junsee; 12-05-2012 at 08:57 PM.

  • #8
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by Junsee View Post
    PHP Code:
    for ( var 0spans.length; ++) { 
    No that didn't work either, no change on Opera
    and the other broswers (Which still work fine)
    To give a clean starting point for analysing the problem, you should update the online site to reflect the changes, including validated markup.

  • #9
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by felgall View Post
    If that is true then why is all of Google's JavaScript code such an antiquated mess.
    I cited a for loop ranging error in isolation, which I maintain a programmer of either language would not have made, or at worst would have spotted it immediately.

    They have a large number of Java experts working for them who would surely recognise that all their JavaScript is garbage if the two languages were similar enough for people working in one to spot errors in the other
    Whether or not that would happen, doesn't dictate that in practice any remedial action would follow.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •