answersLogoWhite

0


Best Answer

After some discussion, here's a simple way to put the question: [ How do you clear all the values in a form? ] The question isn't asking to reset the values; But to clear them. To answer this question, I will show a very simple form that uses JavaScript to clear the two textboxes in a form, when you press a button. ---- <html><head><title>Clearing Forms!</title> <script type='text/javascript'> function clearForm() { document.loginForm.username.value = ""; document.loginForm.password.value = ""; } </script> <body> <form name='loginForm' action='login.php' method='post'> <input type='text' name='username' id='username' value='Type Username' size='20' /> <br /> <input type='password' name='password' id='password' value='Type Password' size='20' /> <br /> <br /> <input type='submit' value='Log in' /> <input type='button' onClick='clearForm()' value='Clear Fields' /> </form> </body> </html> ---- The above HTML + JavaScript outputs two textboxes for user input: One that already says "Type username" and one that says "Type Password". Below them are two buttons; One that submits the information, and another that clears all the information. How does this work? In simple terms, when the normal button is clicked (Not the submit button), the JavaScript function clearForm() (Which is a custom function, created earlier in the <head>) is activated. Whatever clearForm() is said to do, happens. Lets look at what it's actually supposed to do. ---- document.loginForm.username.value = ""; ---- "document" means something's going to change in the output document. "loginForm" is the thing that is changing. "loginForm" is the name of the form the fields are in. "username" is the field that is going to change. "value" is the thing that is going to change in "username". "=" self explanatory. "" means nothing - Null, if you will. That one line of JavaScript will set the username field to empty - Nothing / Null, free to write in again. You should repeat this line as necessary to suit all the input variables you have.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you clear all the values in a form in HTML?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you get a whole HTML address when you only have part of an HTML?

All HTML addresses have "http://" in front of them and ".[domain]" after them, just type in the missing parts :)


What is the meaning of HTML?

HTML is stand for Hyper Text Markup language. HTML is a skeleton of your website. HTML is a markup language which is very useful for designing a website because without html we can't design a website that's why because html we provide all design pattern for design a website and all browser is only understand HTML format. For more info visit @javatpoint


What is HTML-only?

All websites use HTML, but some sites use HTML in conjunction with one or more other coding languages like Javascript or CSS. HTML-only means it uses just the basic coding.


Colors in HTML are specified as three two-digit hexadecinal numbers how many different colors can be specified in HTML?

This is a homework question, so I won't answer it directly.But a two-digit hexadecimal number can have 256 different values - 00 to FF - so with three of them you can combine any of the 256 values of the first color with any of the 256 values of the second and third color, for a total of 256 * 256 * 256 different combinations.Even though you can specify that many colors, it does not necessarily mean that the computer screen can show them all. See related link for more on web colors.


What are the last two tags of an HTML document?

The last two tags of an HTML document are the and tags. These tags mark the end of the body and the entire HTML document, respectively. Here's a breakdown of the structure: HTML Use code with caution. Learn more The tag indicates the end of the body content, which is where the visible elements of the web page are placed. It tells the browser that the structural elements of the page have been defined. The tag marks the end of the entire HTML document. It signals to the browser that it has reached the final element of the document and can start rendering the page. Together, these two tags enclose all the HTML content and provide a clear structure for the web page.

Related questions

Is xHTML the same as HTML strict and what is a HTML frameset declaration?

Yes, XHTML is just the stricter form of HTML. It means that you have to close all the tags that you have opened.


How does HTML code produce forms in a browser?

HTML has predefined functions. The &lt;form&gt; elements binds all the elements within it.


What's the full form of HTML?

HTML is stand for Hyper Text Markup language. HTML is a skeleton of your website. HTML is a markup language which is very useful for designing a website because without html we can't design a website that's why because html we provide all design pattern for design a website and all browser is only understand HTML format. For more info visit @javatpoint


Why xhtml is made?

XHTML is Extensible Hyper Text Markup Language. It is a stricter form of HTML with all tags closed.


What are the values that form the basis of the American way of life?

Freedom and equality


What is meant by method equals post in HTML language?

method="POST" is a common attribute of the HTML &lt;form&gt; tag. What this does is tells the form that it needs to "post" the data to whatever file you have specified in your "action" attribute of the form tag. So your form tag might look something like this: &lt;form action="receive.php" method="POST"&gt;Insert form data here&lt;/form&gt; Again, this will tell the form to post all the data that the user has entered into it to the receive.php file.


Does Yahoo have HTML format?

Yes, nearly all pages must be in html.


What is the function of HTML in a webpage?

The function of HTML as a scripting language is limited to it's design. All the design developed can be viewed by HTML.


What the major problem to create a HTML?

There are no such problems to create HTML pages. All you need to do is create an HTML document and run it on a browser.


How to make a form in HTML?

You can create a Form in HTML using the &lt;FORM&gt; tag. A sample form tag would be like &lt;FORM name = "xxx" method = "xxx" action = "xxx"&gt; ..... &lt;/FORM&gt; Here name refers to the name of the form. This is the name with which you can call the form elements. Method refers to the way the form elements would be submitted. Either a GET or a POST Action refers to the URL to which the form is supposed to submit the information when the request is submitted. The &lt;FORM&gt; and &lt;/FORM&gt; tags enclose all the form elements. The form can have text fields, buttons, radio buttons, check boxes etc...


Did yourgroup have any trouble agreeing on the seven most important values why did you agreeor disagree?

No, our group did not have trouble agreeing on the seven most important values. We had clear discussions and were able to prioritize the values that aligned with our organization's mission and goals. Ultimately, we all agreed on the importance of the selected values to ensure consistency in decision-making and actions.


Is values subjective or objective?

The word 'values' is the plural form of the noun 'value', and the present tense of the verb 'to value'. The noun values can be subjective or objective, for example: The values of these homes has finally started to rise. The man is a scoundrel, he has no values at all.