[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Count rows in a textbox - Javascript

Posted on 2005-05-17
4
Medium Priority
?
427 Views
Last Modified: 2012-05-05
I need when a user clicks on a button it popups up a window with the total number of rows of data entered into a textbox.  There is no text wrapping.  
thx
0
Comment
Question by:LosBear
  • 2
4 Comments
 
LVL 36

Expert Comment

by:Zyloch
ID: 14021737
Assuming your textbox is document.getElementById('myTextBox') then:

onclick = "var box = document.getElementById('myTextBox');boxArray = box.value.split(/\n/);alert(boxArray.length);"
0
 
LVL 1

Author Comment

by:LosBear
ID: 14022020
thx for the help

what i have at this point is very simple:


....<head>

</head>
<body>

     <form method="post" action=".index.aspx">
          <textbox name="myTextBox"></textBox>
          <input type="submit" value="Submit">
     </form>
</body>....

how do i implement what you wrote?


0
 
LVL 16

Accepted Solution

by:
Joe earned 400 total points
ID: 14022602
....<head>

</head>
<body>

     <form method="post" action=".index.aspx">
          <textbox name="myTextBox"></textBox>
          <input type="button" value="Count" onclick = "var box = document.getElementById('myTextBox');boxArray = box.value.split(/\n/);alert(boxArray.length);" />
          <input type="submit" value="Submit">
     </form>
</body>
0
 
LVL 1

Author Comment

by:LosBear
ID: 14026479
thx :-)
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

613 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question