In this code, I am creating number of Decoder outputs (D1,D2,D3…) depending on Decoder Type (4×1, 8×1, 16x) in the truth table.
If the Decoder Type is 4×1 I create 4x outputs 4*(D0,D1,D2,D3) for 4 different Decoders.
If the Decoder Type is 8×1 I create 2x outputs 2*(D0,D1,D2,D3,D4,D5,D6,D7) for 2 different Decoders.
If the Decoder Type is 16×1 I create 1x outputs 1*(D0,D1,D2,D3,D4,D5,D6,D7,...,D15) for 1 Decoder.
Now to make it easy for the user to distinguish between the various decoders, I would like to put the decoder name ontop of the corresponding Decoderoutputs. For example When I have 4×1 decoders, how can I put headers Decoder1, Decoder2, Decoder3, Decoder4 on top of (D0,D1,D2,D3)(D0,D1,D2,D3)(D0,D1,D2,D3)(D0,D1,D2,D3)?
P.S. In the code you can change the decodertype to 8x1 or 16x1. It’s defined as follows:
var decoderType="4x1";
The idea is to use
colspanproperty oftdtag. You should add the following code togenerateTruthTableHTMLfunction:Edited fiddle