Jump to content
Killersites Forums

Please need help with buttons in javascript


DREAMBUILDS
 Share

Recommended Posts

Hello to experts.

 

I have one problem:

 

There are few buttons on the site and I need code for them, when one button is clicked to stay at this point ( pressed look with different color )and when other is clicked, first one is back in his normal state and this second is clicked with this second color ( another button image ).

 

Can you help me somehow?

 

Thank you very much in advance.

 

regards,

 

DREAMBUILDS

Link to comment
Share on other sites

If you're using dreamweaver, in the menu go to insert -> image objects -> rollover image. Just select the two images, and the code will be inserted for you.

 

Or go to:

http://javascriptkit.com/mousewhipper/index.htm

 

It will tell you where to insert your code.

 

Thank you, I already did that, but the point is that I want menu button to stay down ( showing rollower image ) on press and do not move from this position until I press another button. This is the mystery to me... :(

Link to comment
Share on other sites

I've only used 2 stage javascript buttons. If you know css, then I would suggest using image sprites. It uses one image, but with all 3 states in the same image. The css positions the part of the image in a viewable area for the given state.

 

This article will show you how.

 

http://www.alistapart.com/articles/sprites/

Link to comment
Share on other sites

I've only used 2 stage javascript buttons. If you know css, then I would suggest using image sprites. It uses one image, but with all 3 states in the same image. The css positions the part of the image in a viewable area for the given state.

 

This article will show you how.

 

http://www.alistapart.com/articles/sprites/

Thank you, I will try with css.

Link to comment
Share on other sites

If your buttons are links to other pages, it sounds as if you want the "current page" code where the current page button is different until you click another button to go to another page.

 

See http://www.wickham43.net/highlighthome.php the third item where button images have been used. I could have used sprites but didn't there. The main reason for using sprites is to avoid a flash in the display on hover while a new image is downloaded. A sprite just moves the position of an image so that another part of a combined image shows without a flash.

 

In my example I didn't need sprites because the display will flash anyway when moving to another page, but would have helped if I also wanted a different image on hover.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...