我正在做关于扫描仪的元素。因此,如果我完成扫描条形码,将出现警告框并显示食品的成分。但是我在警告框中发现了问题,它出现了但只显示 native 警告框。 有人可以帮忙吗,如何更改警告框的样式。
我的代码如下:
var localJSONFile= "db/product.json";
$.getJSON(localJSONFile)
.success(function(data, status, xhr){
$.each(data, function(i, product){
if(result.text == product.barcode){
alert( "name: " + product.name + "\n" +
"barcode: " + product.barcode + "\n" +
"status: " +product.status + "\n" +
"E-code: " + product.e_code + "\n" +
"Ingredients: " + product.ingredients + "\n" +
"Country: " + product.country + "\n" +
product.image
);
}
});
})
最佳答案
警告框是原生样式的,不能修改,而是摆脱警告,让你自己的简单警告弹出来显示信息。
关于javascript - Javascript 中的警告框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28728018/