The javascript for the numeric textbox is compatible with IE only. I
haven't experimented with a Firefox compatible version of it yet.
sure it's possible.
Steve C. Orr, MCSD, MVP
"Karl" <kthompson@nospam.pine-grove.com> wrote in message
news:OupDEt7NFHA.1372@TK2MSFTNGP10.phx.gbl...
>
> Hi Steve,
>
> I don't know if you ran into this before or not. But I tried your numeric
> textbox and it seems that the javascript does not work in FireFox. That
> is, I can type any character I please. IE worked just fine.
>
> Any suggestions as to what I might have to do to rectify this? (I doubled
> checked, Javascript is enabled.) I've copied the source of the page below
> in case you see anything obvious.
>
> Oh, one other thing. :-) Even in IE, the user, if they type a cursor key,
> the cursor moves. Do you know why the browswer still responds to a
> cursorkey stroke? It looks to me as if the Javascript should prevent that
> as well.
>
> Thanks,
> Karl
>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
> <HTML>
> <HEAD>
> <title>WebForm1</title>
> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
> <meta name="CODE_LANGUAGE" Content="C#">
> <meta name="vs_defaultClientScript" content="JavaScript">
> <meta name="vs_targetSchema"
> content="
http://schemas.microsoft.com/intellisense/ie5"> > <LINK REL="stylesheet" TYPE="text/css" HREF="StyleSheet1.css">
>
> </HEAD>
> <body MS_POSITIONING="GridLayout">
> <form name="Form1" method="post" action="WebForm1.aspx" id="Form1">
> <input type="hidden" name="__VIEWSTATE"
> value="dDwtMTExMzYxMDEzOTt0PDtsPGk8MT47PjtsPHQ8O2w8aTw1Pjs+O2w8dDxwPDtwPGw8b25LZXlQcmVzczs+O2w8VmFsaWRhdGVOdW1lcmljKCk7Pj4+Ozs+Oz4+Oz4+Oz4VkqDNHdqjFodNfkCACgw0HXMbWQ=="
> />
> <script language=javascript>function ValidateNumeric(){var keyCode =
> window.event.keyCode;if (keyCode > 57 || keyCode <
> 48)window.event.returnValue = false;}</script>
>
>
> <input name="TextBox1" type="text" id="TextBox1" style="Z-INDEX: 101;
> LEFT: 344px; POSITION: absolute; TOP: 88px" />
> <input name="TextBox2" type="text" id="TextBox2" style="Z-INDEX: 102;
> LEFT: 344px; POSITION: absolute; TOP: 136px" />
> <input name="NumericTextbox1" type="text" id="NumericTextbox1"
> onKeyPress="ValidateNumeric()" style="Z-INDEX: 103; LEFT: 352px; POSITION:
> absolute; TOP: 192px" />
>
> </form>
> </body>
> </HTML>
>
>
>
>
> Steve C. Orr [MVP, MCSD] wrote:
>> You can inherit and extend the standard textbox.
>> Here is an example:
>>
http://steveorr.net/articles/InheritAndExtend.aspx >>
>> However, I'm not sure if you'll be able to accomplish your particular
>> goal by inheriting the textbox. If it's possible, it will take some
>> fancy Javascript.
>> Otherwise you may need to fake a textbox with a div and some fancy
>> Javascript.
>> You might be able to use a 3rd party textbox control that uses a
>> technique like this already, such as one of these:
>>
http://steveorr.net/freecontrols/textboxes.aspx >>