Guitar Chord onHover-like effect

G

Gord Murray

Stuck with a problem.

http://eastontario.com/guitar/onHover.htm
"View Source" of course.

This might be a boon for the guitar teachers/students.
When you pass the mouse pointer over Chord letter link, holding it there for
the downloading of images, eventually diagram open to assist beginners.

How does one preload those images?

Also I might be in need of the redrawing of the picture files involved,
since I've not yet received permission from an originating page.

Anyone out there care to do some charity work for a GNU project?

Surely many wish to help pay back some of the debt they owe to such as
metapad.
Finished product to be posted for free - mirrors appreciated.
Documentation of improvements welcome.

Assistance making this compatible with older versions of Netscape also
appreciated in the useful "thanks, the world is a better place for you" and
an "e-handshake" sort of way.

(e-mail address removed)
 
D

DJ WIce

I get the warning d11 does not exist for line if (isIE)..

function initThis()
{
if(isNS4)skn=document.d11;
if(isIE)skn=document.all.d11.style;
if(isNS6)skn=document.getElementById("d11").style;
}


You clould use here
if..
else if..
else if
it does not solve any problem, it's just that the testing may go faster.

maybe you need to change

images.src = "p" + i + ".gif";

to

images.src = eval("p" + i + ".gif");

I get an error for that line too.


I use MSIE6 on XP, I see the chords, but the first time it's a bit strange.
This might be because of the above images..

Succes,
Wouter





: Stuck with a problem.
:
: http://eastontario.com/guitar/onHover.htm
: "View Source" of course.
:
: This might be a boon for the guitar teachers/students.
: When you pass the mouse pointer over Chord letter link, holding it there
for
: the downloading of images, eventually diagram open to assist beginners.
:
: How does one preload those images?
:
: Also I might be in need of the redrawing of the picture files involved,
: since I've not yet received permission from an originating page.
:
: Anyone out there care to do some charity work for a GNU project?
:
: Surely many wish to help pay back some of the debt they owe to such as
: metapad.
: Finished product to be posted for free - mirrors appreciated.
: Documentation of improvements welcome.
:
: Assistance making this compatible with older versions of Netscape also
: appreciated in the useful "thanks, the world is a better place for you"
and
: an "e-handshake" sort of way.
:
: (e-mail address removed)
:
:
 
R

Randy Webb

DJ said:
I get the warning d11 does not exist for line if (isIE)..

function initThis()
{
if(isNS4)skn=document.d11;
if(isIE)skn=document.all.d11.style;
if(isNS6)skn=document.getElementById("d11").style;
}


You clould use here
if..
else if..
else if
it does not solve any problem, it's just that the testing may go faster.

very very marginally. Only the time it takes NS4 to execute, and fail,
the last two tests. For IE, it will only speed it up for the time it
takes to execute the last test. For NS6, it won't speed it up at all.

But from the looks of what you quoted, the OP is using browser detection
and wherever he learned that technique, he needs to black-mark it and
never return to it. And find a good site to learn from.
maybe you need to change

images.src = "p" + i + ".gif";

to

images.src = eval("p" + i + ".gif");


maybe you need to learn how to script.

if i contains the number 11, both lines will resolve to this:

images[11].src = "p11.gif"; //a string in both instances.

Which makes the eval both unneeded and useless.

http://www.jibbering.com/faq/#FAQ4_40

With regards to eval.

http://www.jibbering.com/faq/#FAQ2_3

With regards to quoting/posting.

http://www.jibbering.com/faq/#FAQ4_26

With regards to "browser detection"

http://www.jibbering.com/faq/

With regards to javascript in general. It could be helful reading for
you, and the OP as well.
 
R

Richard Cornford

maybe you need to change

images.src = "p" + i + ".gif";

to

images.src = eval("p" + i + ".gif");

I get an error for that line too.

<snip>

You would! If you don't understand how the - eval - function works you
should not use it, and you certainly should not ever recommend its use
to anyone else.

<URL: http://jibbering.com/faq/FAQ4_40 >

Richard.
 
B

Brian Genisio

DJ said:
I get the warning d11 does not exist for line if (isIE)..

function initThis()
{
if(isNS4)skn=document.d11;
if(isIE)skn=document.all.d11.style;
if(isNS6)skn=document.getElementById("d11").style;
}


You clould use here
if..
else if..
else if
it does not solve any problem, it's just that the testing may go faster.

Possibly, a better way yet, is:

if(document.getElementById)
skn = document.getElementById("d11").style;
else if(document.all)
skn = document.all.d11.style;
else if(document.d11)
skn = document.d11;
else
// error

The reason I say this, is because it is very dangerous to check for
browser versions... changes in browsers in the future can make the code
break. Instead, you check for the capability. You can store the
capabilities up front, instead of the browser info, and do something like:
if(HAS_ELEMENT_BY_ID)
....
maybe you need to change

images.src = "p" + i + ".gif";

to

images.src = eval("p" + i + ".gif");

I get an error for that line too.


Hmmmm... I dont think eval fixes anything. There does not seem to be
anything wrong with this, unless images is not defined (or i).

Take what I say for what it's worth... nothin,
Brian
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top