473,241 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

How to preserve cursor position

dj12345
14
i have function to make character in lowercase if a text is in uppercase


Expand|Select|Wrap|Line Numbers
  1.    function upperCase(x)
  2.     {   
  3.         try
  4.         {
  5.             var y=document.getElementById(x).value;
  6.             document.getElementById(x).value=y.toLowerCase();
  7.         }
  8.         catch(Error)
  9.         {
  10.         }
  11.     }

i am calling
Expand|Select|Wrap|Line Numbers
  1. <asp:TextBox ID="txtUrl" Width="450px" runat="server" Wrap="true" onkeyup="upperCase(this.id)" TextMode="MultiLine"></asp:TextBox>

but whenever i type anything withing typed text for eg. if the textbox already have string "texttexttext" n if i try to modify the middle character then on upperCase function call the the function male the character to lowercase in then cursor position goes to end of the text... so i am not able to type anything in the middle... so what is the option to preserve the cursor position at it is which was befor..
Mar 17 '09 #1
2 2376
Dormilich
8,658 Expert Mod 8TB
the only solution on my mind is changing the event (onchange, maybe onblur). the reason (I think) for the behaviour is that the value becomes re-written (well first deleted). maybe someone know how to position the cursor in a string.....
Mar 17 '09 #2
acoder
16,027 Expert Mod 8TB
That's what I would suggest. However, if you insist on using onkeyup, have a play with this (taken from this thread).
Mar 17 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dave Hammond | last post by:
I have an html element (a link) with an onclick handler which opens a popup window, and would like to position that window at the coordinates where the element appears on the page. I have...
25
by: JeffS | last post by:
Honest, I scoured the comp.lang.c.faq for this but found nothing. :) Is there a library function for placing the cursor position in the console? Or is it something that can only be done with a...
7
by: Steve | last post by:
does any one know a way to determine the position of the cursor in a text box. I would like to position a list next to the current position for context commands. I am using...
1
by: Tantra Veda | last post by:
Hello C# gurus, I have a question about finding cursor position in NumericUpDown control. On my form I have a numericUpDown control with 2 decimal places. I want to increment value in the numeric...
1
by: Paul | last post by:
Hi all, I am making a DirectInput application wich must report correctly the cursor position in windowed mode (it means it has to be the same as Microsoft Window´s cursor position). First of...
3
by: Al-Burak | last post by:
I hope everybody is having a fantastic X-Mas, I will hate you for that since I have to be at the computer trying to keep my current job, grrr. :) OK, folks, jokes aside I have a question that...
2
by: tony | last post by:
Hello! Assume I catch a double click in a form by using the event handler that forms designer create for me. Now to my question when I double click in the form the event handler is trigged...
4
by: Brandon McCombs | last post by:
Does anyone know of an easy way to set the position of the cursor in a TextBox? If I set text in the box that is longer than the length of the TextBox the position of the cursor is at the very end...
0
by: nagarjunt | last post by:
Hi, This is nag. I have a problem with infragistics7.1 UltraTextEditor control. I am using C# code in windows form. I have UltraTextEditor control(With multi line enabled) in my Windows...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.