1) I know virtually nothing about javascript.
2) I'm doing some on-line help and have used a couple of scripts provided by another person to 'switch' the graphic that appears on the screen when a 'drop-down' hotspot is activated.
Whatever :-) The problem is that the script works fine for drop-downs from the main page, but not for drop-downs within drop-downs.
Now the javascript question... looking at the script, I can't see anything obvious. What I want to know is how I can debug the script. How can I display values, whatever, to see what is happening.
I want to know if the conditions are being satisfied, and if not, why!
Thanks for any help anyone can throw my way.
The code (the part that matters, at least):
------------------------------------------
function swapImages(imageType, imageName)
{
if (imageType == 1)
{
matchpattern = /arrowdown.gif/;
if (matchpattern.test(imageName.src))
{
//Replace image name leaving path intact
newName = replaceSubstring(imageName.src, "arrowdown.gif", "arrowright.gif")
document.images[imageName.name].src=newName;
}
else
{
//Replace image name leaving path intact
newName = replaceSubstring(imageName.src, "arrowright.gif", "arrowdown.gif" )
document.images[imageName.name].src=newName;
}
}
}
|