Converting a VB6-like specification of a form into a Web page displaying the form
As a part of my current pet project, I have to write an program that takes as input the specification of a form and generates as output the necessary HTML and CSS code to display the form as a Web page. The exact input format is irrelevant to this question, but the information it contains is similar to the information in a Visual Basic 6 form file, minus the Visual Basic code. In particular, the sizes and positions of the 开发者_JS百科form's controls are represented as XY pairs in an absolute coordinate system.
The main problem I am facing is that I do not know how to map the information contained in the input format (control sizes and positions, tab order, etc.) to the information contained in the HTML and CSS files (when to use placeholder div
s, when to use CSS floats, etc.).
I emphasize on the word information because I do of course know how to generate HTML- and CSS-formatted files given the information they should contain.
In particular, the sizes and positions of the form's controls are represented as XY pairs in an absolute coordinate system.
In that case, the easiest method is to use absolute positioning.
Something like this: http://jsfiddle.net/R8K6u/
You should be able to directly map width
/height
/left
/top
from the VB6 equivalent.
精彩评论