JavaScript setAttribute compatibility problem solution

  • 2020-03-26 23:59:45
  • OfStack

 
var asubmit = document.getElementById("submit"); 

 
<span style="white-space:pre"> </span>asubmit.setAttribute("onclick","alert(' Please check your cell phone number ');"); //It works in firefox, but not in ie

 
<span style="white-space:pre"> asubmit.setAttribute("onclick","javascript:document.buyform.submit();");</span> //It works in ie, it works in firefox

Related articles: