0

リダイレクトとして機能し、ユーザーがラジオボタンをクリックしたときにいくつかの値を設定するコードがあります。chromeとfirefoxでは、これらのスクリプトは完全に機能しますが、IEでは何も起こらないようです。

HTML

<td>
    <input type='radio' id="order_type6" name='order_type' value="5"
        onClick="selectOrderType('1')">
    <label for="order_type6"><strong>Facility Employee</strong></label>
</td>
<td>
    <input type='radio' id="order_type7" name='order_type' value="5" 
        onClick="selectOrderType('1')">
    <label for="order_type7"><strong>Private Contract</strong></label>
</td>

JS関数:

function selectOrderType(type)
{
    console.log(type);
   //replace '&load=1' with '&neworder=1'
    $location = window.location.href.replace(/&load\=1/,'&neworder=1#');
   //replace '#' at the end of the string with '' + $ordertype
    window.location.href = $location.replace(/#?$|&order_type\=\D?/,'&order_type='+type);
}
4

1 に答える 1

2

console.logを削除するか、F12キーを押してコンソールを開きます。

IEが開いていない場合、IEはコンソールをサポートしません

'console'はInternetExplorerの未定義のエラーです

またはに変更しますwindow.console && console.log(type)

于 2012-10-12T16:46:39.570 に答える