我想仅使用Javascript来触发
有什么建议吗?
tel:12345
HREF,而不是使用锚点。我只想获取输入字段的值,并使用JS提示用户拨打输入的号码。我的触发器将是位于该字段旁边的按钮。有什么建议吗?
tel:12345
HREF,而不是使用锚点。我只想获取输入字段的值,并使用JS提示用户拨打输入的号码。我的触发器将是位于该字段旁边的按钮。使用:
window.open('tel:12345');
window.location.href='tel:12345';
,哪一个更好? - adrianTNT<button onclick="myFunction()">
Call
</button>
function myFunction(){
var a = document.getElementById('input').value;
window.location.href = 'tel:' + a;
}
You can also view the live version on my website:
https://www.theharnishes.com/phone.html
Here we make a button and assign a function to it that bassically select the input, get the value, and the window.location.href will have the value of the input and it'll sent the url to call any number.
JS调用非常简单。 使用我们的:onclick函数,Location和tel 我们可以在任何标签中实现, 窗口。位置('tel:number')
点击我拨打199