Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: disabling the backspace key


Message #1 by srotondo@h... on Thu, 8 Aug 2002 17:44:43
i've coded an online survey in asp.  when filling out the survey, if my 
cursor is in a dropdown listbox and I hit the backspace key, i'm booted 
out of the survey web page and wind up at my previous url address.

i've added vb script in an attempt to disable the backspace key however, 
it is not working.  when i apply the same code logic to disable my enter 
key, it works fine.  is there something funky with backspace?  

it seems vb script does not recognize 08 (or just 8) as the key code for 
backspace.

here's my code:

Sub document_onkeypress 
	
if window.event.keyCode = 08 then
	if dropdownListFocus = 1 then
		window.event.returnValue = false	
	else
	end if
end if	

End Sub

dim dropdownListFocus   
Sub select1_onfocus 'select1 is the name of the dropdown list.
	dropdownListFocus = 1
end Sub

Sub select1_onblur
	dropdownListFocus = 0
End Sub

Message #2 by "Gavin Landon" <glandon@g...> on Mon, 12 Aug 2002 15:49:41 -0500
Here is a couple of ways:  http://www.geeksatwork.com/geek-code/

<srotondo@h...> wrote in message news:202715@a..._databases...
>
>
> i've coded an online survey in asp.  when filling out the survey, if my
> cursor is in a dropdown listbox and I hit the backspace key, i'm booted
> out of the survey web page and wind up at my previous url address.
>
> i've added vb script in an attempt to disable the backspace key however,
> it is not working.  when i apply the same code logic to disable my enter
> key, it works fine.  is there something funky with backspace?
>
> it seems vb script does not recognize 08 (or just 8) as the key code for
> backspace.
>
> here's my code:
>
> Sub document_onkeypress
>
> if window.event.keyCode = 08 then
> if dropdownListFocus = 1 then
> window.event.returnValue = false
> else
> end if
> end if
>
> End Sub
>
> dim dropdownListFocus
> Sub select1_onfocus 'select1 is the name of the dropdown list.
> dropdownListFocus = 1
> end Sub
>
> Sub select1_onblur
> dropdownListFocus = 0
> End Sub
>
>
>



  Return to Index