Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 25 OCT 2001 05:18:11PM Rick Todd wrote:

I have been trying to create a submit button using an image and I keep getting an error.

If I use the regular submit command it works fine.

Can anyone see what I am doing wrong?

Thanks

Rick


At 26 OCT 2001 04:42AM Oystein Reigem wrote:

Rick,

I'm not doing web development at the time, and I'm definitely no walking html and javascript manual. But here's what you could do. This is what I did myself once I needed a button with an image:

Start with using an save.jpg

First possible problem: An image might not tell the user as precisely as a button text what the button does. Fix: Add an ALT attribute with a bubble help text:

save.jpg]

More serious problem: An save.jpg[/url][/i]

…and put what it is you want the button to do in the HREF value. What you want it to do is to submit, of course, which you can do with a tiny bit of javascript…

submit()

…but I think you have to tell HREF this is javascript and not some ordinary URL

javascript:submit()

…so the result becomes:

save.jpg[/url]

Next problem is your image doesn't change when you click it. A button does. The fix is to have two images. Your SAVE.JPG is the normal version of the button image. Make a second image SAVE2.JPG that is the depressed version of the button image. Then do… …sorry… …I realize don't know exactly what to do.

But I can teach you something realted. Say you want the image to change (highlight) when the mouse cursor hovers above it. Say SAVE.JPG is the normal version of the image and SAVE2.JPG is the highlighted version. Then you first must give your image a name…

save.jpg

…because your tag need two "handlers" to change the image, and these handlers must be explicit about what it is they work with. Here's the final result, with the mouse handlers in place:

[url=javascript:submit()" onmouseover=SaveButton.src=SAVE2.JPG'" onmouseout=SaveButton.src=SAVE.JPG'"]save.jpg

If it looks messy you can format it a bit, e.g:

save.jpg

I hope I got it everything right. Good luck!

- Oystein -

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/0bd3df07bb197c7085256af0007505cd.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1