表单定位 iframe 在 FireFox 中不工作

Form targeting iframe not working in FireFox

我有一个针对隐藏 iframe 的表单。这对 IE 工作正常,但在 FireFox 中提交表单时没有任何反应。未提交。知道造成差异的原因吗?

表单和 iframe 在这里:

<form name="dial" method="get" target="callout" action="/cgi-bin/make_call.php">    
    &nbsp;&nbsp;&nbsp;
    <input type="text" style="width:190px;" id="calling" name="calling" />
    <input type="hidden" name="caller" value="<? echo $extension; ?>">
    &nbsp;&nbsp;
    <input type="submit" name="search" class="btn btn-info btn-large" style="width:65px; height: 30px; position:relative;top:-5px;left:-2px; padding:0.2em; " value="Dial" />
</form>
<iframe name="callout" width="0" height="0"></iframe>

正在加载的页面是:

<?
$caller = $_GET['caller'];
$calling = $_GET['calling'];

//Clean the non numbers out of our string
$calling = preg_replace("/[^0-9]/","",$calling);

//If we are dialing a 7 digit number add a 9 to access an outside line
if(strlen($calling) == 7){
    $calling = "9".$calling;
    }

//If we are dialing a 10 digit number add 9 and 1 to access outside line
if(strlen($calling) == 10){
    $calling = "91".$calling;
    }

//If we are dialing a 11 digit number add 9 to access outside line
if(strlen($calling) == 10){
    $calling = "9".$calling;
    }

header("Location: http://XX.X.XX.XX:8070/ShoreTelWebSDK/REST/DialNumber?callingExtension=$caller&destinationNumber=$calling");  
?>

如果我更改脚本以输出测试消息并以可见的 iframe 为目标,我在 FireFox 中仍然一无所获,但它在 Internet Explorer 中再次完美运行。知道造成差异的原因吗?

您可能遇到此处报告的问题:Firefox form targetting an iframe is opening new tab tl;dr:尝试向 iframe 添加一个 "id" 属性,其值与 "name" 属性相同,并且看看它是否能解决您的问题。

尝试将“@”添加到 iframe name/target。

<iframe name="@callout"></iframe>
<form target="@callout"></form>

有助于标识符识别名称。名称需要具体且唯一。