• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Q&A

Q1:I noticed that the <img> tag in HTML can't have onMouseOver or onClick event handlers. How can my scripts respond when the mouse moves over an image?
A1: The easiest way to do this is to make the image a link by surrounding it with an <a> tag. You can include the BORDER=0 attribute to prevent the blue link border from being displayed around the image. You'll see an example of this in Hour 15.
Q2:My image rollovers using onMouseOver works perfectly in Internet Explorer, but not in Netscape. Why?
A2: Re-read the previous answer, and check whether you've used an onMouseOver event for an <img> tag. This is supported by Internet Explorer, but not by Netscape.
Q3:What happens if I define both onKeyDown and onKeyPress event handlers? Will they both be called when a key is pressed?
A3: The onKeyDown event handler is called first. If it returns true, the onKeyPress event is called. Otherwise, no keypress event is generated.
Q4:When I use the onLoad event, my event handler sometimes executes before the page is done loading, or before some of the graphics. Is there a better way?
A4: This is a bug in some older versions of JavaScript. One solution is to add a slight delay to your script using the setTimeout method. You'll learn how to use this method in Hour 13, “Using Windows and Frames.”


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint