A computational study of the bandgap structure in one-dimensional photonic crystals (PhCs) built with an elementary cell consisting of two sub-layers or four sub-layers is presented. The computational approach uses a finite element method to solve the differential systems with the continuous jump conditions. It is well known that the band structure and its features are strongly influenced by the number of periods, the lattice constant and the material dispersion. By choosing the geometrical parameters of the elementary cell optimally and controlling the band structure, we study the relationship between the gap and the number of periods, the lattice constant and the material dispersion. Then the optimal design of one-dimensional photonic crystals can be obtained by the numerical simulation. The numerical results show our finite element algorithm is efficient.