Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

count line number and display (textarea)

Status
Not open for further replies.

codeone

Programmer
Mar 25, 2003
343
US
Is it possible to use javascript to display the line number of a textarea, I have a page set up to direct a value to a text box and it counts 1 - 2 via arrow up and arrow down.

Obviously that isnt going to do, I need a script which can tell which line in the textarea it is on...

any help is greatly appreciated,

code one

p.s. client side project, this would be like the line count thing in notepad or any html editor
 
I need to understand this a bit more.

Question 1 ...

Are you (a) emulating an editor, that uses line numbers?
or (b) like Notepad .. that for me at least has no line numbers?

Or (c) are you just providing a helpful additional item to display during normal textarea input operation.

Question 2 ...

What is the word "it" in "it is on"?

Is "it" (a) the mouse pointer, or (b) the text pointer during editing, or (c) a cursor-like control driven only by arrow keys, or (d) the full length of data in the text area ?

Question 3 ...

Are you really just saying that
- as the user keys into any textbox, the length of his text grows
- this growth can create multiple lines, and
- not all lines are visibly displayed in the crampted lines of the textarea
- so, the user gets confused and loses track of which line he is "on" - especially after keying a new-line key

... and you simply want to tell him which line he is typing on ... to reduce this classic confusion!









 
freindly poster:

thanks
for replying

Im trying to mimick the line count like in NotePad or html editor so the user will know what line number they are on, when they are typing syntax...

thanks

code one
 

I don't think you can get an accurate line count display that would work consistently across multiple browsers / OS.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top