teamdad
05-25-2003, 06:29 PM
My form code below works great if something is entered into all the fields A, B & C but I need some help with a code ...maybe an if then or something that will help with the format of the output. If something is entered in A & C only and leaving B blank, it still takes the space for it in the output of D. If either of the fields is left blank I would like to have it not be added to the output or skipped entirely so that only what has been entered will show up in the output.
Any help on this is more than greatly appreciated!!!
<html>
<SCRIPT language = JavaScript>
function translate() {
A = document.form.a.value
B = document.form.b.value
C = document.form.c.value
D = (A + ","+B+","+C)
document.form.d.value = D }
</SCRIPT>
<FORM NAME = form>
<INPUT TYPE = Text NAME = a SIZE = 20 value =""><br>
<INPUT TYPE = Text NAME = b SIZE = 20 value =""><br>
<INPUT TYPE = Text NAME = c SIZE = 20 value =""><br>
<Input Type = Button VALUE = "Translate" onClick = "translate()"><br>
<INPUT TYPE = Text NAME = d SIZE = 20 value ="">
</form>
</html>
Any help on this is more than greatly appreciated!!!
<html>
<SCRIPT language = JavaScript>
function translate() {
A = document.form.a.value
B = document.form.b.value
C = document.form.c.value
D = (A + ","+B+","+C)
document.form.d.value = D }
</SCRIPT>
<FORM NAME = form>
<INPUT TYPE = Text NAME = a SIZE = 20 value =""><br>
<INPUT TYPE = Text NAME = b SIZE = 20 value =""><br>
<INPUT TYPE = Text NAME = c SIZE = 20 value =""><br>
<Input Type = Button VALUE = "Translate" onClick = "translate()"><br>
<INPUT TYPE = Text NAME = d SIZE = 20 value ="">
</form>
</html>