生成结构完整的网页

在浏览器打开我们上一节生成的网页,右击,查看源代码,可以看到其代码为:

没有head? 没有body? 如果你接触过HTML网页设计,你会知道这不是一个结构完整的网页。

你也不要担心,正如我们所演示的,目前所有的浏览器,都能正确解释上面的代码。

不过遵循规范总是没有错,我们来改进一下HttpRequst事件的代码:

Dim sb As New StringBuilder
sb
.AppendLine("<!doctype html>")
sb
.AppendLine("<html>")
sb
.AppendLine("<head>")
sb
.AppendLine("<meta charset='utf-8'>")
sb
.AppendLine("<title>表单</title>")
sb
.AppendLine("</head>")
sb
.AppendLine("<body>")
sb.AppendLine("<form enctype='multipart/form-data' method='post' id='form1' name='form1'>")
sb
.AppendLine("产品: <input name='cp' id='cp'><br/><br/>")
sb
.AppendLine("客户: <input name='kh' id='kh'><br/><br/>")
sb
.AppendLine("雇员: <input name='gy' id='gy'><br/><br/>")
sb
.AppendLine("单价: <input Type='number' name='dj' id='dj'><br/><br/>")
sb
.AppendLine("折扣: <input Type='number' name='zk' id='zk' min='0' max='0.15' step='0.01'><br/><br/>")
sb
.AppendLine("数量: <input Type='number' name='sl' id='sl'><br/><br/>")
sb
.AppendLine("日期: <input Type='date' name='rq' id='rq'><br/><br/>")
sb
.AppendLine("<input Type='submit' name='Sumbit' id='Sumbit' value='确定'>")
sb
.AppendLine("</form>")
sb
.AppendLine("</body>")
sb
.AppendLine("</html>")
e
.WriteString(sb.ToString)

现在生成的就是一个结构完整的网页,在浏览器看到的代码是:


本页地址:http://www.foxtable.com/mobilehelp/topics/0014.htm