anguage="javascript">
function checkv()
{
if (form1.jxname.value.length == 0)
{
alert("请填写姓名和地址!");
form1.jxname.focus();
return false;
}
else if(!(check_number(form1.id1.value)))
{
alert("数量只能为数字")
form1.id1.focus();
return false;
}
else
return (true);
}
function check_number(myint)
{
var checkOK = "0123456789";
var checkStr = myint;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
return (false);
}
return (true);
}
</script>
</html>
2. 2.asp文件
<%
''////////////////////取表单数据
response.write("共"+request.form("count")+"记录")
i=request.form("count")
jxname=request.form("jxname")
jxadd=request.form("jxadd")
jxtel=request.form("jxtel")
response.write(request.form("jxname"))
response.write("<br>")
response.write(request.form("jxadd"))
response.write("<br>")
response.write(request.form("jxtel"))
response.write("<br>")
str1=trim(request.form("id1"))
str2=trim(request.form("id2"))
str3=trim(request.form("id3"))
arrayA=Split(str1,",")
arrayb=Split(str2,",")
arrayc=Split(str3,",")
For i = 0 to UBound(arrayA)
Response.Write "<LI>" & arrayc(i)&"--"&arrayb(i)&"--"&arrayA(i)
Next
''///////////////////写入xml文件
Dim objDom
Dim objRoot
Dim objChild1
Dim objChild2
Dim objChild3
dim objChild4
Dim objPI
Dim PINode
Set objDom = Server.CreateObject("Microsoft.XMLDOM")
''/////写入样式
Set PINode=objDom.CreateProcessingInstruction("xml-stylesheet", "type=''text/xsl''
href=''list.xsl''")
objDom.appendchild PINode
''/////创建根接点
Set objRoot = objDom.createElement("kucunbiao")
objDom.appendChild objRoot
Set objChild1 = objDom.createElement("jxname")
objChild1.text=jxname
objRoot.appendChild objChild1
Set objChild2 = objDom.createElement("jxadd")
objchild2.text=jxadd
objRoot.appendChild objChild2
set objChild3=objDom.createElement("jxtel")
objChild3.text=jxtel
objRoot.appendChild objChild3
set objChild4=objDom.createElement("kucun")
objRoot.appendChild objChild4
For i = 0 to UBound(arrayA)
Set objField = objDom.createElement("field")
''创建属性taborder。
Set objattTabOrder = objDom.createAttribute("taborder")
''设定taborder的属性值
objattTabOrder.Text = i
''把taborder的属性值追加到field元素中去。
objField.setAttributeNode objattTabOrder
''创建一个新的元素field_value.
Set objFieldValue2= objDom.createElement("name")
objFieldValue2.Text = arrayc(i)
Set objFieldValue = objDom.createElement("guige")
objFieldValue.Text = arrayb(i)
set objFieldValue1=objDom.createElement("shuliang")
objFieldValue1.Text = arrayA(i)
''追加field元素为根元素的子元素。
objChild4.appendChild objField
''追加field_value做为子元素的内容
objField.appendChild objFieldValue
objField.app