The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

javascript question? by ag__wyvern 2005-01-27 13:32:49
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;
      }
   }
}
[ Reply ]
  Can you give a better explanation? by ToLazyToThink2005-01-27 13:57:06
    Quick explanation by ag__wyvern2005-01-27 16:34:29
      Usually you use alerts by ToLazyToThink2005-01-27 17:20:05
  You can do that without Javascript by Arachnid2006-11-19 12:55:59
    Too bad that doesn't work in all browsers. by Michiel2005-01-27 14:30:06
      Javascript doesn't work in all browsers either (n/ (n/t) by Arachnid2005-01-27 14:35:48
        But in quite a lot more than :hover by Michiel2005-01-27 14:39:15

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)