CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript programming (http://www.codingforums.com/forumdisplay.php?f=2)
-   -   Opera Browser - Mouse over issue (http://www.codingforums.com/showthread.php?t=283523)

Junsee 12-04-2012 11:06 AM

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.

Logic Ali 12-04-2012 07:13 PM

Quote:

Originally Posted by Junsee (Post 1297098)
I have some js code (not my own as I am really lacking in java knowledge)

So is the author of that code.


Quote:

Code:

                for ( var s = 0; s <= spans.length; ++s ) {

Remove the '=' as it causes an addressing error, then see if it changes anything.

Goos 12-04-2012 10:43 PM

You should validate your HTML aswell.
Having block-elements inside inline-elements is part of the problem.

felgall 12-05-2012 01:09 AM

Quote:

Originally Posted by Logic Ali (Post 1297202)
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.

Logic Ali 12-05-2012 10:27 AM

Quote:

Originally Posted by felgall (Post 1297310)
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.

felgall 12-05-2012 06:33 PM

Quote:

Originally Posted by Logic Ali (Post 1297399)
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?

Junsee 12-05-2012 08:45 PM

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

Logic Ali 12-06-2012 03:18 AM

Quote:

Originally Posted by Junsee (Post 1297539)
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.

Logic Ali 12-06-2012 03:31 AM

Quote:

Originally Posted by felgall (Post 1297484)
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.

Quote:

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.


All times are GMT +1. The time now is 11:51 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.