>>>>>I recently changed a page to use an image instead of a submit button. Before, I was able to tab, tab, tab and space over the submit button to submit the form. Now, I have an image and the space over the image scroll down the page. How can I define the image to submit the form when I hit space when the focus is over it?
>>>>
>>>>You could probably include a hidden submit type button and call it's Click() event from this image's onClick(). The following is untested VBScript code:
>>>>
Sub myImg_onClick()
>>>> mySubmit.Click()
>>>>End Sub
>>>
>>>Hitting space over the image doesn't fire the onClick() event.
>>
>>Would putting it inside of an anchor tag work? Although it works with an Enter, not a space, something like:
>>
<A HREF="javascript:myImgClick()"> ..etc.</A>
>
>It is already within an anchor. The problem is to have the image to recognize the space key.
The onkeypress event should be of help then:
<SCRIPT Language=VBScript>
Sub myAnchorSelect()
Dim sCode
sCode = window.event.keycode
If sCode=32 Then
Alert "Space bar was pressed!"
End If
End Sub
Sub myImgSelect()
mySubmit.Click()
End Sub
</SCRIPT>
<A HREF="javascript:myImgSelect" onkeypress="javascript:myAnchorSelect()"> ..etc.
HTH