Re: questions regarding PHP and Forms
| From: | Miles Thompson | Date: | Sun, 29 Jan 2006 00:33:12 +0000 |
| Subject: | Re: questions regarding PHP and Forms | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229410@lists.php.net to get a copy of this message | ||
At 05:39 PM 1/28/2006, Paul Goepfert wrote:
Thanks for the help everyone. I have decided to use javascript to deal with my second problem. I understand that this is not a JavaScript fourm but I am having some trouble getting my JS function to work correctly. Here is my JS code. function getEquipment () {Javascript@LaTech.edu Registration is required. MT -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 1/27/2006var mylist = document.getElementById("equip"); if (mylist.options[mylist.selectedIndex].value=="other") { document.writeln("<tr>"); document.writeln(" <td align="left">Other</td>"); document.writeln(" <td><input type="text" name="other" size="20"></td>"); document.writeln("</tr>"); }} This is my code for where the function is called <select name="equipment" size="1" id="equip" onChange="getEquipment()"><option value="treadmill">Treadmil</option> <option value="exercise bike">Exercise Bike</option> <option value="other">Other</option> <option value="rowing machine"selected>Rowing Machine</option></select>My problem is when the page loads in a web browser the Option "Other" is selected every time. From what you can see from my code "Rowing machine is the one that I want to be shown when the page loads. Anyway can anyonne tell me why my code is not executing correctly. I am not too familiar with java script. What I am trying to accomplish is if Other is selected then add a new table row below the drop down menu with the content that I have in the function. If no one can help with this would someone please direct me to a Java Script Forum. Thanks Paul