J'essaie de faire est d'obtenir toute la valeur de 10 textbox et y arriver au total et l'imprimer sur soumettre. J'ai fait var id = getelementbyid (id) puis x = var1 + var2 mais rien ne se passe. Aidez-moi s'il vous plaît à ce sujet.résumer les valeurs des entrées
<script type="text/javascript"> function test(){ document.getElementById('out').style.display = "block"; return false; } </script> <form action="" onsubmit="return test()"> <div class="selftest"> <p><input type="text" size="1" id="text1" /><label> I Love Animals</label></p> <p><input type="text" size="1" id="text2" /><label> I Pay Close Attention To Details</label></p> <p><input type="text" size="1" id="text3" /><label> I Communicate Well With Others</label></p> <p><input type="text" size="1" id="text4" /><label> I Am Very Dependable</label></p> <p><input type="text" size="1" id="text5" /><label> I Get Along Well With Others</label></p> <p><input type="text" size="1" id="text6" /><label> I Am In Good Physical Shape</label></p> <p><input type="text" size="1" id="text7" /><label> I Understand I May Be Bitten</label></p> <p><input type="text" size="1" id="text8" /><label> I Handle Stress Well</label></p> <p><input type="text" size="1" id="text9" /><label> I Am Well Organized</label></p> <p><input type="text" size="1" id="text10" /><label> I Am Intelligent</label></p> <p><input type="submit" value="Submit Answers" /></p> </div> </form> <div id="out" style="display:none;"> Here are the results of your Veterinary Technician Self Test: <result> Obviously veterinary technicians must love animals, but they must love to be around and communicate with people also because they spend much of their time interacting with co-workers and pet owners. An individual should be able to take a leadership role and be able to talk with strangers, to be a good candidate for a veterinary technician career. Those who want to become veterinary technicians must have good communication skills and have the ability to work well with others. They must also be well-organized and be able to pay attention to detail. They must be of above average intelligence and have a good understanding of math and science. It is necessary that a veterinary technician be dependable since an animal’s life may rest in their hands when treatments must be delivered in a timely manner. A veterinary technician’s job can be very demanding. He or she must be able to spend hours on their feet and have the ability to lift and restrain animals. Unfortunately, being bitten is part of the job. It does not occur often, but a veterinary technician must realize that it is a real possibility. Due to the possibility of emergency situations, a veterinary technician must be able to handle stress well. From the results of the self test, you have many of the characteristics needed to work in this field, but you may need to do some more research before you go any further. Start by reading <a href="http://www.vettechuniversity.com/veterinary-technician-career-information/" target="_blank"><strong>Veterinary Technician Career Information</strong></a>. </div>
S'il vous plaît poser des questions si vous ne comprenez pas ma question :)
Je ne vois pas où vous essayez d'accéder aux zones de texte? –
Je supprime le getelementbyid pour la zone de texte parce que c'est inutile. Et j'essaye de mettre la valeur sur