Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 21st, 2004, 10:29 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Quote:
quote:I need to use an image as a button since it is not a submit button
You can just use a plain button, instead of an image. It looks just like a submit button.

<input type='button' onclick='doSomething()' value='click' />

Quote:
quote:When the button has the focus, I need it to change shape for instance.
A normal button like I mentioned above has 3D effects just like the submit button (on most platforms, anyway).

However, you could dynamically change the src of the image to an image that looks like the first one, except that it's a different shape or color.

<input type='image' onmousedown='this.src="down_image.png"' onmouseup='this.src="up_image.png"' src='up_image.png' />

Let me know if either of these is what you need.

HTH,

-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once :-)
 
Old September 21st, 2004, 10:40 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is not what I want.
I have three buttons:
     a submit button
     an image (up-arrow): when clicked, it goes up a list
     an image (down-arrow): when clicked, it goes down a list.
When the page is loaded, the focus is on the "down-arrow" button.
Now, I only want the down-arrow to change to "another-down-arrow" when the focus is on it.


 
Old September 21st, 2004, 10:47 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I think I'm still missing something. Your up arrow, for instance. You want it to look different when the focus is on it, or when someone is clicking on it?

You can do onfocus, but usually people go for the onmousedown and onmouseup effects.

<input type='image' src='up-arrow.png' onfocus='this.src="another-up-arrow.png"' onblur='this.src="up-arrow.png"' />

Now do I understand?

-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once :-)
 
Old September 21st, 2004, 10:55 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That's right!!!!. Thank you so much!!!


 
Old September 21st, 2004, 10:59 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Now, instead of vchanging the shape of an image, how can I do almost the same thing but change the color?

 
Old September 21st, 2004, 11:18 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Just change another-up/down-arrow.png to have a different color.

-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)
 
Old September 21st, 2004, 11:27 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am sorry to bother again but I don't know how to modify the color of my image!!!


 
Old September 21st, 2004, 11:57 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How would I do it ?


 
Old September 21st, 2004, 03:42 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

What program did you use to create the image?

-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)
 
Old September 22nd, 2004, 03:02 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I did not have to create it, I already had a .gif. What I needed were 2 arrows in 3D (up and down). I would be nice to have the same one in red when the focus is on them.






Similar Threads
Thread Thread Starter Forum Replies Last Post
re: color change jack_in_black ASP.NET 2.0 Professional 0 July 11th, 2006 07:24 AM
Rotating shape in VBA (not center of shape) Piblon Excel VBA 3 April 13th, 2006 04:04 AM
change link color swastikagaur Classic ASP Basics 1 March 11th, 2005 10:35 PM
Color change possability? rolandatem VB How-To 2 November 19th, 2004 03:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.