怎么解除浏览器禁用js?

JavaScript015

怎么解除浏览器禁用js?,第1张

准备的材料分别是:chrome浏览器、电脑。

1、首先打开chrome浏览器,点击菜单上的“设置”按钮。

/iknow-pic.cdn.bcebos.com/f31fbe096b63f6245621f0e08944ebf81b4ca3d1"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/f31fbe096b63f6245621f0e08944ebf81b4ca3d1?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/f31fbe096b63f6245621f0e08944ebf81b4ca3d1"/>

2、其次,鼠标拉到底部,点击底部的“高级”按钮。

/iknow-pic.cdn.bcebos.com/72f082025aafa40fac9c073ea564034f79f019ff"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/72f082025aafa40fac9c073ea564034f79f019ff?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/72f082025aafa40fac9c073ea564034f79f019ff"/>

3、接着,点击“网站设置”按钮。

/iknow-pic.cdn.bcebos.com/6c224f4a20a4462338b36c819622720e0df3d7dc"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/6c224f4a20a4462338b36c819622720e0df3d7dc?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/6c224f4a20a4462338b36c819622720e0df3d7dc"/>

4、从弹出的面板,再再点击“JavaScript”菜单。

/iknow-pic.cdn.bcebos.com/cefc1e178a82b901b3d40ad07d8da9773812efdd"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/cefc1e178a82b901b3d40ad07d8da9773812efdd?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/cefc1e178a82b901b3d40ad07d8da9773812efdd"/>

5、最后将“允许(推荐)”按钮打开,之后刷新页面即可生效。

/iknow-pic.cdn.bcebos.com/dcc451da81cb39db66b8aeb5de160924aa1830dd"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/dcc451da81cb39db66b8aeb5de160924aa1830dd?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/dcc451da81cb39db66b8aeb5de160924aa1830dd"/>

示例如下:

<input id="btnShow" type="button" value="点击" class="btn">

上面是一段按钮的html代码

如果要用原生的js来禁用这个按钮

可以用这样:

document.getElementByIdx_x_x("btnShow").disabled=true(这样就把按钮禁用了)

如果要重新开启按钮,则可以让disabled=false即可

那么在jquery下面要如何设置呢?其实也很简单

利用jquery的attr的方法即可

$("#btnShow").attr({"disabled":"disabled"})

如要让按钮恢复可用,可以采用removeAttr方法把disabled属性删除即可。

$("#btnShow").removeAttr("disabled")