Re: questions regarding PHP and Forms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ()
{
        var 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

Javascript@xxxxxxxxxx

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/2006

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux