Here's what I'm trying:
PHP Code:
echo '<head>';
if ($MFh){echo '
<script type="text/javascript">
function showinput(is_par) {
if (is_par == 1) {
document.getElementById("addfield").innerHTML = "<tr><td>Multiplier Factor (Horizontal):</td><td><input type="text" name="MFh" value="'.$MFh.'"></td></tr>";
} else if (is_par == 0) {
document.getElementById("addfield").innerHTML = "";
}
}';
echo '</script>';
}else
{echo '
<script type="text/javascript">
function showinput(is_par) {
if (is_par == 1) {
document.getElementById("addfield").innerHTML = "<tr><td>Multiplier Factor (Horizontal):</td><td><input type="text" name="MFh" value="'.htmlspecialchars($_POST['MFh']).'"></td></tr>";
} else if (is_par == 0) {
document.getElementById("addfield").innerHTML = "";
}
}
</script>';
}
echo '</head><body>';
My selection:
PHP Code:
echo '
<select class="pulldown" name="is_par" id="is_par" onChange="javascript: showinput(document.getElementById(\'is_par\').selectedIndex)">
<option value="null" selected="selected">---</option>
<option value="no">No</option>
<option value="yes">Yes</option>
</select>';
and the Div tag where the new field should apear:
PHP Code:
echo '<div id="addfield"></div>';
There's no Parse Errors, but the Javascript has no effect.