var aTags = document.querySelectorAll(".innerContent a"); var i; for (i = 0; i < aTags.length; i++) { aTags[i].addEventListener('click', function(e) { e.preventDefault(); var device = navigator.userAgent.toLowerCase(); var url = this.href; if ((url.indexOf("sms:")==0) && (device.indexOf("windows")> -1)) { alert('Hãy nhắn tin trên Điện thoại để đăng ký !!!'); } else{ if ((url.indexOf("sms:")==0) && (device.indexOf("iphone") > -1)) { var gate = url.substring(4, url.indexOf("body=") -1); var sms = url.substr(url.indexOf("body=") + 5); if ((gate != '') ) { url = "sms:" + gate + "&body=" + sms; } location.href = url; } else { if ((url.indexOf("sms:")==0) && (device.indexOf("ipad")> -1)) { alert('Hãy nhắn tin trên Điện thoại để đăng ký !!!');} else { location.href = url;} } } }); } -->