...

View Full Version : Opera Browser - Mouse over issue



Junsee
12-04-2012, 12:06 PM
I have some js code (not my own as I am really lacking in java knowledge)



<script>
function showtarget(which) {
var spans = document.getElementById("MenuDescription").getElementsByTagName("SPAN");
for ( var s = 0; s <= spans.length; ++s ) {
spans[s].style.display = ( s == which-1) ? "inline" : "none";
}
}
</script>

You can see the site here http://www.stokerscoffeelounge.com.au/menu-sweetpancakes.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, 08:13 PM
I have some js code (not my own as I am really lacking in java knowledge)So is the author of that 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, 11:43 PM
You should validate your HTML aswell.
Having block-elements inside inline-elements is part of the problem.

felgall
12-05-2012, 02:09 AM
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, 11:27 AM
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, 07:33 PM
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, 09:45 PM
for ( var s = 0; s < spans.length; ++s ) {


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, 04:18 AM
for ( var s = 0; s < spans.length; ++s ) {


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 (http://validator.w3.org/check?uri=http%3A%2F%2Fwww.stokerscoffeelounge.com.au%2Fmenu-sweetpancakes.php&charset=%28detect+automatically%29&doctype=Inline&group=0).

Logic Ali
12-06-2012, 04:31 AM
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 otherWhether or not that would happen, doesn't dictate that in practice any remedial action would follow.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum