/    Sign up×
Community /Pin to ProfileBookmark

Tab indexing in <img src=…>

I have a HTML page with two buttons “save” and “cancel”. These save and cancel buttons are not standard buttons. But instead I used my own buttons which are images. And I implemented “OnClick”, “Onmouseover”, etc for those images.

Now, the problem is when I am navigating using tab key, there is no tab stop on these two buttons.

I have read in the online tutorials that img src does not support tab index. Now what am I supposed to do?

And also I fixed my problem changing from img src to <input type=”image” src=”….

Now I want to know if the two ways of implementations are the same and if not what could be the possible problems that I would face.

Thanx in advance.
Neelima

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@pj59Jan 10.2005 — Hello!

You have to be aware of the fact that <input type=image> is a submit button. If you simply want some code to be executed when it is clicked, you will have to avoid the submission of the form. The other thing is: <img src=...> is not a form element, so you have to handle the passing of form objects or form element objects as arguments in a different way than you could using the <input type=image>.

Regards PJ
Copy linkTweet thisAlerts:
@pj59Jan 12.2005 — Hi!

Forgot to mention that (if the only thing you are dissatisfied with concerning your buttons is the missing tab indexing) you can simply put your <img> tags in anchors and attach the event handlers to the <a> tags. They would be tab indexed depending on their position between (or above/ below) the form fields.

Regards PJ
×

Success!

Help @a_neelima spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...