html
<input type="text" id="input" placeholder="请输入链接">
<button id="aaa">清除http://</button>
js
document.getElementById('aaa').onclick = function () {if(document.getElementById("input").value.indexOf("https://")>=0){
var str = document.getElementById("input").value;
var reg1 = new RegExp("https://","g");
var a1 = str.replace(reg1,"");
document.getElementById('input').value=a1;
}
else if(document.getElementById("input").value.indexOf("http://")>=0){
var str = document.getElementById("input").value;
var reg1 = new RegExp("http://","g");
var a1 = str.replace(reg1,"");
document.getElementById('input').value=a1;
}
else {
alert("没有http://");
}
};