?
Solved

HTML Help

Posted on 2003-03-10
7
Medium Priority
?
135 Views
Last Modified: 2010-04-09

 i have a Text box and a button on the page. Every time the user clicks the button after entering the data into the text box the data  should apper on the same page.

      Textbox

      Button ----> On Click the Data should Apper here       *****

 Also when the User writes again into the textbox and clicks the button the previous iteration data and the current data should appear.
 This should happen for 15 iterations.
 
 Kindly let me know the code about this
0
Comment
Question by:manishmarathe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 

Author Comment

by:manishmarathe
ID: 8107317
Thanx
0
 
LVL 5

Expert Comment

by:gator4life
ID: 8107807
Here ya go:

<html>

<head>
     <script type="text/javascript">
     <!--
          function WriteText(oForm) {

               oTextbox = oForm.myTextbox;
               sText = oTextbox.value;
               document.getElementById('myDiv').innerHTML += sText + '<br>';
               oTextbox.value = '';
               oTextbox.focus();
          }
     //-->
     </script>
</head>

<body>
     <form name="myForm">
          <input type="text" name="myTextbox">
          <input type="button" name="myButton" value="Write Text" onclick="WriteText(this.form)">
     </form>
     <div id="myDiv"></div>
</body>

</html>

gator4life
(chomp, chomp)
0
 

Author Comment

by:manishmarathe
ID: 8108172
Thanx gator4life,

          I am sorry i wanted a bit different .I will edit the question.

          But thanx a lot.

          Text Box

          Button1     Button2
   
           On clicking on Button1 the data goes on adding into the array without being displayed and when we click on button2 the data of all the 15 iterations get displayed
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 5

Accepted Solution

by:
gator4life earned 200 total points
ID: 8108339
Try this:

<html>

<head>
     <script type="text/javascript">
     <!--
          var aText = new Array();
          var i = 0;

          function AddToArray(oForm) {

               with (oForm.myTextbox) {

                    aText[i] = value;
                    value = '';
                    focus();
               }

               i++;

               if (i == 15) {

                    oForm.myButton1.disabled = true;
                    oForm.myTextbox.disabled = true;
               }
          }

          function DisplayArray(oForm) {

               var sText = '';

               for (var j = 0; j < aText.length; j++)
                    sText += aText[j] + '<br>';

               document.getElementById('myDiv').innerHTML = sText;
          }
     //-->
     </script>
</head>

<body onload="document.myForm.myTextbox.focus()">
     <form name="myForm">
          <input type="text" name="myTextbox">
          <input type="button" name="myButton1" value="Add to Array" onclick="AddToArray(this.form)">
          <input type="button" name="myButton2" value="Display Array" onclick="DisplayArray(this.form)">
     </form>
     <div id="myDiv"></div>
</body>

</html>

gator4life
(chomp, chomp)
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 8820521
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
 
LVL 5

Expert Comment

by:gator4life
ID: 8821013
Hey COBOL, I think I deserve the points.  I am pretty sure that I answered this question with a more than thorough solution.

gator4life
(chomp, chomp)
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9012652
It is time to clean this abandoned question up.

I am putting it on a clean up list for CS.

<recommendation>
points to gator4life -- Grade A

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&

0

Featured Post

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

765 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