MouseDown Effect on Buttons in Page with Frames

Results 1 to 2 of 2

Thread: MouseDown Effect on Buttons in Page with Frames

  1. #1
    Join Date
    Dec 1969

    Default MouseDown Effect on Buttons in Page with Frames

    Hello,<BR><BR>This is what I have:<BR><BR>TopNav.html (Top Navigation top frame)<BR>LeftNav.html (Left Navigation frame)<BR>MainContents.html (Main Contents frame)<BR>Index.html (HTML page bringing all above frames)<BR><BR>TopNav.html has 5 different buttons that will always be present while a visitor browse troughs the site. LeftNav.html will display buttons based on what the visitor clicked from the TopNav.html frame. The buttons in TopNav.html have MouseOver, MouseDown, and MouseOut events to display different images at each event. Upon click, the buttons from TopNav.html frame open two pages - one in the LeftNav.html frame and the other in the MainContents.html, which all works fine. The buttons on TopNav.html also swap to a specified image onMouseOver and restores it to the original image onMouseOut. The problem is with MouseDown state of the button. Because I have frames the page opens in the bottom frame, but the button is in top frame so when I click on the button it goes through the MouseDown state for a very brief seconds then restores the image to original so even though that page is loaded on the bottom frame the button doesn&#039;t show down state, because the page is not open in the same frame as the button is on. If I don&#039;t use the MouseOut event then the button stays on MouseDown state even when I click on other buttons and other pages are open in the bottom frame!<BR><BR>Does anyone know how to implement a MouseDown effect/event on buttons that are placed in one frame, but corresponding pages appear on second frame? The button should restore original image just as soon as another button on the same frame or LeftNav.html frame is clicked. Would I need to use some Java or VB function to do this? If so is there one out there that can at least point me in the right direction or is there a simple script to do this? Basically, what are they ways I can achieve MouseDown effect with three frames in a page?<BR><BR>Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: MouseDown Effect on Buttons in Page with Frame

    "MouseDown effect"? You mean make the button look depressed by swapping the image?<BR><BR>Okay, I&#039;ll assume you have some JS knowledge and wrote the image swap yourself. If you used DreamWeaver (or whatever), then it&#039;s time to break out a book (because if you don&#039;t understand that, then understanding the following will be a challenge!).<BR><BR>The function you use to swap images - what do you pass it? An element reference? The image ID? The new image SRC attribute? The most common ones I&#039;ve seen you pass it an ID and SRC. I&#039;ll not worry too much about this (because you should already have it), but here&#039;s my basic outline:<BR><BR>function SwapImage(sImageID, sNewSrc)<BR>{<BR> // ...<BR>}<BR><BR>Okay. That function probably sits in the TopNav.html frame. You&#039;ve not told us what the frame names are, so I&#039;ll assume that they&#039;re the names of the default HTML files. So, a full reference to TopNav could be:<BR><BR>top.TopNav;<BR><BR>So, that means a full reference to our new function could be:<BR><BR>top.TopNav.SwapImage;<BR><BR>So, in ANY of your other pages, assuming the top navigation file had loaded, you could put:<BR>&#060;script&#062;top.TopNav.SwapImage("im ageName", "depressedImage.jpg");&#060;/script&#062;<BR><BR>Now, okay, this needs some work to "remember" which image is depressed and that kind of thing (for if the user runs their mouse over all your buttons), but that&#039;s the basic.<BR><BR>There are other ways to approach the same problem. You could have a list of known URLs in the TopNav.html page in an array. You could have a function that&#039;s called every second (or 2 or whatever) that checks the URL of the LeftNav (or MainContents) window and works out what section they&#039;re in and depresses the associated button.<BR>I actually like this approach better in some ways. At least if your image paths change, you&#039;ve only got a single reference point to modify...<BR><BR>Anyway, does that give you a starting point?<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts