473,761 Members | 9,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

add text to textfield and/or textarea

5 New Member
Hi there!

I´m making a little project that uses while loop.
Here is my code:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  
  3. var counter = 0;
  4. var koniec = 100;
  5.  
  6. while(counter <= koniec) {
  7.         document.write(counter);
  8.         document.write(linebreak);
  9.         counter++;
  10.     }
  11. </script>
  12.  
I want the while loop to output numbers in a textfield. I´ve done this by using "document.myFor m.myText.value = counter",
but it only shows the final number ( in this case 100) and I want it to show al the progress like that:

https://www.youtube.com/watch?v=WfVNUpu VYkY&feature=pl cp

Thanks a lot.
Aug 21 '12 #1
3 2430
gits
5,390 Recognized Expert Moderator Expert
sure:

Expand|Select|Wrap|Line Numbers
  1. textfield.value = counter;
simply overwrites the value of the textfield. i assume you want to use a multiline textarea and it should look more like:

Expand|Select|Wrap|Line Numbers
  1. textarea.value += '\n' + counter;
which should append a linebreak and the next value to the textarea.
Aug 21 '12 #2
lordmat
5 New Member
thanks, seems working but I am not using a textarea I am using an textfield and I want to display just the current number not every one with enter :/

thanks anyway :)
Aug 21 '12 #3
gits
5,390 Recognized Expert Moderator Expert
then the shown requirement when following the link in the original post is just misleading and the question was not clear enough.
Aug 22 '12 #4

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

Similar topics

2
2313
by: C. Armour | last post by:
Help me, I'm suffering! Situation: I have a load() function which loads a bunch of TextFields with values. There are TextListeners registered for each of these TextFields. Thus, changing the text in any of them fires off a TextEvent, even if done programmatically (by means of setText()). The problem: I need all the various TextEvents fired off during the load operation (as a result of using TextField.setText())
1
6434
by: Veverita | last post by:
Hi there I'm hoping that someone can help me with a question I have about javascript syntax. I got an html page that uploads an image and some text field to a database. What I'd like to do is modify the content of one of the textfields prior to it being submitted to the database. Specifically, I need to
1
3202
by: Suresh | last post by:
How do I insert a char into the textfield on the keypress event of another textfield? I have two textboxes, "text1" and "text2". Important: "text1" is outside the table. "text2" is inside the table cell. On the keydown/keypress/keyup event of "text1", the character which I entered in the "text1" must display in the textfield "text2".
3
5620
by: Sidney Linkers | last post by:
Hi, I'm trying to make a calculated text field in a query where the textvalue is being populated from multiple records. I already use a VBA function to loop through records and concatenate the text. It works but the performance is really bad. I'm looking for a solution in plane SQL, so the looping is done by joining tables. I can't get it to work....
3
8911
by: Cah Sableng | last post by:
Hi all. I am new member of this group. I have a problem with currency formatter function I made. On onkeyup's method of a textfield I add function below: <snip> function formatCurrency(elm) { var str=elm.value; var re = /(-?\d+)(\d{3})(,\d*)?/
9
10790
by: learning | last post by:
Hi! Here's my situation: I have one textfield with one 'submit' button in PAGE1.PHP. When I click on the 'submit' button I am sent to PAGE2.PHP where I have a "switch" routine that checks which 'submit' button was clicked and directs which instructions to do next. My Problem is this: On PAGE1.PHP, there is only one textfield. After filling in the textfield, most of the time people press the 'ENTER KEY' instead of clicking the submit...
2
5490
jkmyoung
by: jkmyoung | last post by:
I was trying to create an applet with a TextField that would only accept an integer, and ignore any other keystrokes. Eg, if a user typed in an 'f' into the field, the TextField should ignore it, and not even put the f into the textbox. However, the TextField does not appear to update until one keypress after I need it to. Eg. if I typed, 10fg, it would end up as "10f" then after the g, become "g10". I'm currently using the keyPressed...
0
1776
by: adamselearning | last post by:
Hi... I've followed Colin Moock's AS3 notes to create a VirtualPet I've got it working from the code at: http://www.adobe.com/devnet/actionsc...n_moock_f6.pdf ...but am now trying to add a textField on the stage that will display the % of calories remaining. Extra code I have created in VirtalPet.as: 1. private var petView (An instance of VirtualPetView) 2. petView.displayInfo() (Called from the digest() method, which is called by...
8
6231
by: ALTAFAD | last post by:
How to copy selected (s) textfield, which those selected through checkbox I like to copy in clipboard. Access textfield data when front of the textfield checkbox is checked if not checked it should not copy in clipboard. If text field has data like that altaf/ahmed mr one field checked goodguydude@thisandthatandtheother.com one field checked...
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9376
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
10136
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
9988
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
9923
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
9811
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
3911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2788
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.