473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

i want a simple custom hiliting button...

hi!

I want to have a custom button change appearance when pressed and then
call a function and change back to its original appearance when released.

here's what i have now, which works mostly. "drop" is my handler for the
button, its argument tells me which button was pressed. i have a number
of these buttons and they are organized in a table.

there is a fair amount of superstition here, the result of many tiny
experiments i ended up with this which seems to work best:

<td>

<A HREF="javascript:drop(0)" onMouseDown="document.images[1].src = 'pressed.gif'"
onMouseOver="document.images[1].src = 'notpressed.gif'"
onMouseOut="document.images[1].src = 'notpressed.gif'"
onMouseUp="document.images[1].src = 'notpressed.gif'">

<IMG SRC="notpressed.gif" HEIGHT= "50" WIDTH= "50" ALIGN= "center" BORDER=0></a>

</td>
pressed.gif is the pressed button's appearance, likewise notpressed.gif
is the normal appearance.

i say this mostly works. there is something i am missing, because the
first press of the first button on a freshly loaded page is weird. and
it is different in different browsers.

in a newer Netscape, the first press first shows no button, then shows
the hilite button and then, when i release the button, it goes to
notpressed.gif. subsequently all buttons work perfectly.

in an older Netscape, the first presses don't work at all, it just shows
a dotted outline of the GIF, until i mouse furiously at a button for a
few strokes within a very short period of time. then all buttons
function perfectly.

in a newer IE, the fist press is a bit weird but all subsequent presses
are perfect, except i get a square hilite box around the button.

i would appreciate a push in the right direction.

-- rob
Jul 20 '05 #1
1 2809
Sounds like a caching issue to me, cache your images onload of the page then
the machine has the images when the user starts clicking.

Hope that helps, good luck.

Stu

PS also having a bunch of links forcing the use is bad for non JS users (i.e
your HREF="javascript:drop(0)" ), this won't work for non JS users.

"robert" <ra*@tiac.net> wrote in message news:3F***************@tiac.net...
hi!

I want to have a custom button change appearance when pressed and then
call a function and change back to its original appearance when released.

here's what i have now, which works mostly. "drop" is my handler for the
button, its argument tells me which button was pressed. i have a number
of these buttons and they are organized in a table.

there is a fair amount of superstition here, the result of many tiny
experiments i ended up with this which seems to work best:

<td>

<A HREF="javascript:drop(0)" onMouseDown="document.images[1].src = 'pressed.gif'" onMouseOver="document.images[1].src = 'notpressed.gif'" onMouseOut="document.images[1].src = 'notpressed.gif'" onMouseUp="document.images[1].src = 'notpressed.gif'">
<IMG SRC="notpressed.gif" HEIGHT= "50" WIDTH= "50" ALIGN= "center" BORDER=0></a>
</td>
pressed.gif is the pressed button's appearance, likewise notpressed.gif
is the normal appearance.

i say this mostly works. there is something i am missing, because the
first press of the first button on a freshly loaded page is weird. and
it is different in different browsers.

in a newer Netscape, the first press first shows no button, then shows
the hilite button and then, when i release the button, it goes to
notpressed.gif. subsequently all buttons work perfectly.

in an older Netscape, the first presses don't work at all, it just shows
a dotted outline of the GIF, until i mouse furiously at a button for a
few strokes within a very short period of time. then all buttons
function perfectly.

in a newer IE, the fist press is a bit weird but all subsequent presses
are perfect, except i get a square hilite box around the button.

i would appreciate a push in the right direction.

-- rob

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rudy | last post by:
Hello all, I'm sure there is, just can't figure it out. I have the RGB code and the color number. But the color doesn't exsist in Visual studio.net. Can I add this color to the system pallet it...
1
by: Robert Neville | last post by:
I am having some trouble with some old code revolving around custom form navigation buttons. My main form has a sub-form with these custom navigation buttons. In other words, the code should be...
6
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A...
0
by: csharpnb | last post by:
Hi all, I've been studying C#/.NET 2.0 for a couple of hours a week for the past couple of weeks. I feel the need to build a somewhat simple Windows application that would accomplish a somewhat...
1
by: Chris Dunaway | last post by:
I have created a simple Extender Provider and when I drop it onto a form, it appears in the component tray, but none of the controls it is supposed to provide a property for show the property in...
1
by: rn5a | last post by:
I have created a custom control button which when clicked displays a message in the JavaScript alert dialog. I could successfully compile the VB class file into a DLL & also could add it to the...
0
by: rn5a | last post by:
A custom control is derived from the WebControl class & encapsulates a TextBox & a Button. When the Button is clicked, the user is shown the JavaScript confirm dialog with the 'OK' & 'Cancel'...
4
by: Jimmy | last post by:
hi, all I'm having a problem with creating custom events in wxpython. I have a class A handling some data processing work and another class B of GUI matter. I need GUI to display information...
1
by: deepapanch | last post by:
Hi All: I am new to C#. Have created a simple outlook add-in, which adds a command bar in Outlook. On click of the button, I would like to load the a simple dialog with a Text Box and a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.