KamikaziRunner
09-25-2005, 05:29 PM
Well, im not new to programming but javascript is starting to piss me off :).
I love php to death, but if course it cant preform some things javascript can, right at the moment i have a select dropdown that has an "onchange" command to a javascript function. Now this function, if the value of select equals something, *displays* another input text that they can enter info into. But its only for this one value, heres the form..
<?
echo '<TR><TD><select name="HitM1" onchange="javascript:Ringer(HitM1)">';
echo '<option value="none">Nobody</option>';
$result = mysql_query($query) or die (mysql_error());
while ($dmi=mysql_fetch_array($result)) {
echo "<option value='".$dmi['CShandle']."'>".$dmi['CShandle']."</option>";
}
echo '<option value="ringer">Ringer</option></select></TD></TR>';
echo '<TR style="display:none" id="HitM11"><TD>';
echo '<input type="text" name="HitM11" maxlength=20 size=20 value="asshole">';
echo '</TD></TR>';
?>
if you cant read php real well, heres it in basic html
<TR><TD><select name="HitM1" onchange="javascript:Ringer(HitM1)">
<option value="none">Nobody</option>';
//Just a database query to create the dropdown menu
$result = mysql_query($query) or die (mysql_error());
while ($dmi=mysql_fetch_array($result)) {
//creates the options
<option value='".$dmi['CShandle']."'>".$dmi['CShandle']."</option>";
}
//adds one more option
<option value="ringer">Ringer</option></select></TD></TR>
//part that i want displayed if "ringer" is selected
<TR style="display:none" id="HitM11">
<TD>
<input type="text" name="HitM11" maxlength=20 size=20>
</TD>
</TR>
and heres the function ive been trying to do, its kinda screwed up because ive been trying tihs serveral ways...
<script language="Javascript">
function Ringer(item) {
var what = item.value;
var target = item.name+"1";
if (what =="ringer") {
target.style.display="";
}
}
</script>
HELP ME PLEASE!
I love php to death, but if course it cant preform some things javascript can, right at the moment i have a select dropdown that has an "onchange" command to a javascript function. Now this function, if the value of select equals something, *displays* another input text that they can enter info into. But its only for this one value, heres the form..
<?
echo '<TR><TD><select name="HitM1" onchange="javascript:Ringer(HitM1)">';
echo '<option value="none">Nobody</option>';
$result = mysql_query($query) or die (mysql_error());
while ($dmi=mysql_fetch_array($result)) {
echo "<option value='".$dmi['CShandle']."'>".$dmi['CShandle']."</option>";
}
echo '<option value="ringer">Ringer</option></select></TD></TR>';
echo '<TR style="display:none" id="HitM11"><TD>';
echo '<input type="text" name="HitM11" maxlength=20 size=20 value="asshole">';
echo '</TD></TR>';
?>
if you cant read php real well, heres it in basic html
<TR><TD><select name="HitM1" onchange="javascript:Ringer(HitM1)">
<option value="none">Nobody</option>';
//Just a database query to create the dropdown menu
$result = mysql_query($query) or die (mysql_error());
while ($dmi=mysql_fetch_array($result)) {
//creates the options
<option value='".$dmi['CShandle']."'>".$dmi['CShandle']."</option>";
}
//adds one more option
<option value="ringer">Ringer</option></select></TD></TR>
//part that i want displayed if "ringer" is selected
<TR style="display:none" id="HitM11">
<TD>
<input type="text" name="HitM11" maxlength=20 size=20>
</TD>
</TR>
and heres the function ive been trying to do, its kinda screwed up because ive been trying tihs serveral ways...
<script language="Javascript">
function Ringer(item) {
var what = item.value;
var target = item.name+"1";
if (what =="ringer") {
target.style.display="";
}
}
</script>
HELP ME PLEASE!