|
-
Sep 24th, 2001, 04:01 AM
#1
Thread Starter
Hyperactive Member
Submit page when an image becomes focused
Hi, I have a image and I want the current page to get submitted when a user tabs to the image.
I thought that I could just go;
<img src="./someimage.gif" onFocus="javascript: document.form1.submit()">
but it does not work..
Any ideas would be appreciated
Thanks
MarkusJ
-
Sep 24th, 2001, 05:09 AM
#2
Hyperactive Member
What you have done is correct, Mark. Jus that you missed the TabIndex Attribute.
Get this:
<img src="c:/pump.gif" tabindex=2 onfocus="javascript:document.myForm.submit()">
By default an image tag wouldn't get focus. For such elements we need to add the TabIndex attribute and specify the Index.
- Jemima.
-
Sep 24th, 2001, 12:33 PM
#3
Frenzied Member
Nice catch, Jemina.
But Markus, why do you want to submit a form when an image gets focus? What if the user was tabbing to something past that image, wanted to enter a value else where or submit a different form on the page, or he was wanting to select an anchor on the page?
I guess if there are no anchors, no inputs, and only one "trigger" picture on the page, then it makes some sense.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|