473,657 Members | 2,690 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to preserve cursor position

dj12345
14 New Member
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 "texttextte xt" 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 2407
Dormilich
8,658 Recognized Expert Moderator Expert
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 Recognized Expert Moderator MVP
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
10113
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 installed a document.onclick event handler which saves the eventX and eventY values, then use those values to set the window top/left coordinates. The problem is that the eventX and eventY values always seem to be the previous coordinates, not the...
25
2654
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 platform API call? I was able to do this in Windows with a Windows.h function, but I want to also do it on Linux/Unix as well. I won't ask for a Linux API call that positions the cursor, as that is
7
9048
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 VS.NET/C#/System.Windows.Forms.
1
5080
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 box by 1 if my cursor is in front of the decimal point. If the cursor is after the decimal point, I want to increment the value by 0.1. How do I accomplish this? Is there a way to find out the cusror position in the control relative to decimal...
1
2385
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 all, I get Windows System Mouse Speed by using the function : SystemParametersInfo(SPI_GETMOUSESPEED, 0, &m_nMouseSpeed,0); After I am reading the last Windows cursor position with GetCursorPos. Then I read all mouse buffered data using...
3
2262
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 might sound a bit dumb, but I am just trying to confirm something, here I go. When opening a 'std::fstream' with the following mode: std::ios_base::out | std::ios_base::app I expect the cursor position at the end of the file, am I right here? I am...
2
5777
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 but when I'm in this event handler I want to find out the cursor position(x,y cordinates) where the double click occurred how is that done? //Tony
4
64868
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 of the line and a user would have to use the arrow keys to move it back to the beginning of the line of text. I'd prefer to set the cursor position automatically to just before the first character of the text. thanks
0
2809
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 Form. A user can drag and drop a text(Usually from a tree node its name would be appended on drag and drop) in this control. Here user can put cursor any where inside this texteditor control and he can drag and drop text into it. Eg: If text editor...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.