JS代码
function chupiaoBillInfo() {
var billID = document.getElementById("txtPiaohao").value;
var txtjiewei = document.getElementById("txtjiewei").value;
var count = document.getElementById("txtCount").value;
var nowTime = document.getElementById("nowTime").value;
var price = document.getElementById("txtPrice").value;
var btID = document.getElementById("selType").value;
var obj = document.getElementById("selType");
var btType = obj.options[obj.selectedIndex].text;
var obj2 = document.getElementById("selectSMxiao");
var sm = document.getElementById("selectSMxiao").value;
if (billID == "" || isNaN(billID) || billID.length != 8) {
alert("请填写8位数字‘起始’票号");
} else if (txtjiewei == "" || txtjiewei == null || txtjiewei.length != 8 || isNaN(txtjiewei)) {
alert("请填写8位数字‘结尾’票号");
} else if (count == "" || isNaN(count)||Number(count)<0) {
alert("请填写正确票据数量");
} else {
//string qishi,string jiewei,string shuliang,string type,string nowtime,string chukukufang,string price
window.external.updatebillInfo(billID, txtjiewei, count, btID, nowTime, sm, price);// 在这句出的错,测试得到所有的值都正常,求解
alert("票据直拨成功");
var div = document.getElementById("yulanDIV");
div.style.display = "none";
var tijiao = document.getElementById("buttijiao");
tijiao.style.display = "block";
}
}
WinForm代码:
/// <summary>
/// 出票
/// </summary>
public void updatebillInfo(string qishi,string jiewei,string shuliang,string type,string nowtime,string chukukufang,string price)
{
............
}错误图片:
function chupiaoBillInfo() {
var billID = document.getElementById("txtPiaohao").value;
var txtjiewei = document.getElementById("txtjiewei").value;
var count = document.getElementById("txtCount").value;
var nowTime = document.getElementById("nowTime").value;
var price = document.getElementById("txtPrice").value;
var btID = document.getElementById("selType").value;
var obj = document.getElementById("selType");
var btType = obj.options[obj.selectedIndex].text;
var obj2 = document.getElementById("selectSMxiao");
var sm = document.getElementById("selectSMxiao").value;
if (billID == "" || isNaN(billID) || billID.length != 8) {
alert("请填写8位数字‘起始’票号");
} else if (txtjiewei == "" || txtjiewei == null || txtjiewei.length != 8 || isNaN(txtjiewei)) {
alert("请填写8位数字‘结尾’票号");
} else if (count == "" || isNaN(count)||Number(count)<0) {
alert("请填写正确票据数量");
} else {
//string qishi,string jiewei,string shuliang,string type,string nowtime,string chukukufang,string price
window.external.updatebillInfo(billID, txtjiewei, count, btID, nowTime, sm, price);// 在这句出的错,测试得到所有的值都正常,求解
alert("票据直拨成功");
var div = document.getElementById("yulanDIV");
div.style.display = "none";
var tijiao = document.getElementById("buttijiao");
tijiao.style.display = "block";
}
}
WinForm代码:
/// <summary>
/// 出票
/// </summary>
public void updatebillInfo(string qishi,string jiewei,string shuliang,string type,string nowtime,string chukukufang,string price)
{
............
}错误图片:
你那里还有什么能用JS调用WINfORM方法并传值的方法了?
这里有解决方法