<a id="phone" href=""></a>
document.addEventListener('DOMContentLoaded', function() {
var link = document.getElementById('phone');
var a = '+38 (095) 123 45 67';
var b = '+38 (098) 123 45 67';
link.innerText = b;
link.setAttribute('href', 'tel:' + b);
setInterval(function() {
link.innerText = link.innerText === b ? a : b;
link.setAttribute('href', 'tel:' + link.innerText);
}, 2000);
});
document.addEventListener('DOMContentLoaded', () => {
const link = document.querySelector('#phone');
let activeIndex = 0;
const numbers = ['+38 (095) 123 45 67', '+38 (098) 123 45 67', '+38 (111) 111 11 11'];
setNumber(numbers[activeIndex]);
setInterval(() => {
setNumber(numbers[activeIndex]);
activeIndex = (activeIndex + 1) % numbers.length;
}, 2000);
function setNumber(number) {
link.innerText = number;
link.setAttribute('href', 'tel:' + number);
}
});
document.addEventListener('DOMContentLoaded', function() {
let numbers = [
'+38 (095) 123 45 67',
'+38 (096) 123 45 67',
'+38 (097) 123 45 67',
'+38 (098) 123 45 67',
'+38 (099) 123 45 67',
];
function getNumber(numbers){
numbers.push(numbers.shift());
return numbers[0];
}
function setNumber(number){
let link = document.getElementById('phone');
link.innerText = number;
link.setAttribute('href', 'tel:' + number);
}
function update(){
setNumber(getNumber(numbers));
}
update();
setInterval(update, 2000);
});