javascript - Javascript 中的警告框

标签 javascript jquery html css

我正在做关于扫描仪的元素。因此,如果我完成扫描条形码,将出现警告框并显示食品的成分。但是我在警告框中发现了问题,它出现了但只显示 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/

相关文章:

javascript - 使用 ng-click Angularjs 调用多个方法

javascript - laravel ajax 表单不会执行提交按钮

html - 如何使条形图不被谷歌条形图中的大量数据压碎?

javascript - VueJs CreateElement() 插入动态html

javascript - 使用正则表达式来匹配一个或多个单词的一部分

javascript - ie7 jQuery.click 仅在目标有背景时注册

javascript - 使用嵌套 ng-repeat 和动态 ng-model 作为对象

javascript - 在 Canvas 中旋转多个文本

javascript - 如何为同一 div 中存在的两种形式切换显示和隐藏?

javascript - 使用 react 更改列表中的事件元素