【发布时间】:2015-12-27 13:27:08
【问题描述】:
我写了一个代码,但它不起作用。
代码:
<?php
$number = $_GET["tel"];
echo '<form action="/" method="get">
<a>Enter the phone number, what you want to call</a>
<input type="tel" name="tel"/>
<input type="submit" onclick="call()" value="Call"/>
</form>
<script>
function call() {
window.open("tel:$number");
}
</script>
';
【问题讨论】:
-
您正在混合使用 php 和 javascript。当用户点击提交按钮时,会调用 javscript 函数,但这对
$number没有任何价值;因为只有在提交表单之后才会设置。
标签: javascript php html phone-number phone-call