我有一个可填写的Pdf文档。我需要根据下拉菜单中的选择填充4个文本字段。 我在行函数SetFieldValues(cDeptName){
我从这里得到了脚本: https://acrobatusers.com/tutorials/change_another_field 并根据我的字段名称进行了更改。
我的下拉菜单称为Diameter(其中有大约10个值)。选择一个时,它将填充4个字段(最大主要直径,最小主要直径,最大螺距直径和最小螺距直径)。每个直径值都有4个不同的值。
我将不胜感激。 这是我的第一个脚本,我想学习。
谢谢。
此致, 亚历克斯
var Diameter = { 1/2":{ MaxMajorDiameter: "0.4985",
MinMajorDiameter: "0.4876",
MaxPitchDiameter: 0.485",
MinPitchDiameter: "0.4435" },
5/8":{ MaxMajorDiameter: "0.6234",
MinMajorDiameter: "0.6113",
MaxPitchDiameter: "0.5644",
MinPitchDiameter: "0.5589" },
3/4":{ MaxMajorDiameter: "0.7482",
MinMajorDiameter: "0.7353",
MaxPitchDiameter: "0.6832",
MinPitchDiameter: "0.6773" },
7/8":{ MaxMajorDiameter: "0.8731",
MinMajorDiameter: "0.8592",
MaxPitchDiameter: "0.8009",
MinPitchDiameter: "0.7946" },
1":{ MaxMajorDiameter: "0.998",
MinMajorDiameter: "0.983",
MaxPitchDiameter: "0.9168",
MinPitchDiameter: "0.91" },
1 1/4":{ MaxMajorDiameter: "1.2478",
MinMajorDiameter: "1.2314",
MaxPitchDiameter: "1.155",
MinPitchDiameter: "1.1476" }};
function SetFieldValues(cDeptName) {
this.getField("MaxMajorDiameter").value = DeptData[cDeptName].MaxMajorDiameter;
this.getField("MinMajorDiameter").value = DeptData[cDeptName].MinMajorDiameter;
this.getField("MaxPitchDiameter").value = DeptData[cDeptName].MaxPitchDiameter;
this.getField("MinPitchDiameter").value = DeptData[cDeptName].MinPitchDiameter;
}
答案 0 :(得分:0)
var theData = {
'-' : {
"mmin" : "-",
"mmax" : "-",
"pmin" : "-",
"pmax" : "-",
},
'1/2"' : {
"mmin" : "0.4985",
"mmax" : "0.4876",
"pmin" : "0.4485",
"pmax" : "0.4435",
},
'5/8"' : {
"mmin" : "0.6234",
"mmax" : "0.6113",
"pmin" : "0.5644",
"pmax" : "0.5589",
},
'3/4"' : {
"mmin" : "0.7482",
"mmax" : "0.7353",
"pmin" : "0.6832",
"pmax" : "0.6773",
},
'7/8"' : {
"mmin" : "0.8731",
"mmax" : "0.8592",
"pmin" : "0.8009",
"pmax" : "0.7946",
},
'1"' : {
"mmin" : "0.998",
"mmax" : "0.983",
"pmin" : "0.9168",
"pmax" : "0.91",
},
'1 1/4"' : {
"mmin" : "1.2478",
"mmax" : "1.2314",
"pmin" : "1.155",
"pmax" : "1.1476",
},
'1 1/2"' : {
"mmin" : "1.4976",
"mmax" : "1.4794",
"pmin" : "1.3893",
"pmax" : "1.3812",
},
'1 3/4"' : {
"mmin" : "1.7473",
"mmax" : "1.7268",
"pmin" : "1.6174",
"pmax" : "1.6085",
},
'2"' : {
"mmin" : "1.9971",
"mmax" : "1.9751",
"pmin" : "1.8528",
"pmax" : "1.8433",
},
'2 1/4"' : {
"mmin" : "2.2471",
"mmax" : "2.2251",
"pmin" : "2.1028",
"pmax" : "2.0931",
},
'2 1/2"' : {
"mmin" : "2.4969",
"mmax" : "2.4731",
"pmin" : "2.3345",
"pmax" : "2.3241",
},
'2 3/4"' : {
"mmin" : "2.7468",
"mmax" : "2.723",
"pmin" : "2.5844",
"pmax" : "2.5739",
},
'3"' : {
"mmin" : "2.9968",
"mmax" : "2.973",
"pmin" : "2.8344",
"pmax" : "2.8237",
},
}