473,396 Members | 1,898 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,396 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 2387
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.