Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Firefox浏览器中使用Javascript_Javascript_Firefox_Browser_Safari - Fatal编程技术网

在Firefox浏览器中使用Javascript

在Firefox浏览器中使用Javascript,javascript,firefox,browser,safari,Javascript,Firefox,Browser,Safari,您好,我有一个相当不寻常的问题,我正在创建一个使用支付网关的网站,我在订单页面上提供了一个数量字段,尽管支付网关公司提供的脚本提供了一个数量字段。我想要的是将所有字段放在一个页面上,然后使用cookie将输入的数量复制并粘贴到支付网关字段(位于另一个页面上)。以下是我检索cookie并将其粘贴到网关页面上的数量字段的代码: <script> function ReadCookie() { var allcookies = docu

您好,我有一个相当不寻常的问题,我正在创建一个使用支付网关的网站,我在订单页面上提供了一个数量字段,尽管支付网关公司提供的脚本提供了一个数量字段。我想要的是将所有字段放在一个页面上,然后使用cookie将输入的数量复制并粘贴到支付网关字段(位于另一个页面上)。以下是我检索cookie并将其粘贴到网关页面上的数量字段的代码:

<script>
        function ReadCookie()
        {
           var allcookies = document.cookie;
           //document.write ("All Cookies : " + allcookies );

           // Get all the cookies pairs in an array
           cookiearray = allcookies.split(';');

           // Now take key value pair out of this array
           for(var i=0; i<cookiearray.length; i++){
              name = cookiearray[i].split('=')[0];
              val = cookiearray[i].split('=')[1];
              //alert(val);
              //document.write ("Key is : " + name + " and Value is : " + value);
              document.getElementById("qty").value = val;
           }
        }
</script>

函数ReadCookie()
{
var allcookies=document.cookie;
//document.write(“所有Cookies:+allcookies”);
//获取数组中的所有cookie对
cookiearray=allcookies.split(“;”);
//现在从这个数组中取出键值对

对于(var i=0;在测试之前您是否清除了cookie?在桌面FF(最新版本)中它对我来说很好用。您显示的JS看起来不会出现跨浏览器问题。我还有最新的FF,清除cookie会有什么帮助,我在脚本中添加了一个警报,以查看cookie是否正确找到,它确实找到了,当警报出现时,正确的数字会出现,然后在我确认警报时会被覆盖。我承认这是我第一次看到它使用过的Cookie,因此不完全熟悉它们的工作原理,尽管从我迄今为止的研究来看,它们非常简单。但是,我会尝试这样做。我尝试在测试之前删除所有Cookie,仍然没有任何区别,仍然会得到数量输入框中出现的随机数,其他人是否知道为什么应该这样做ccur,为什么只在某些浏览器上。测试前是否清除了cookie?在桌面FF(最新版本)中,它对我很好用。您显示的JS看起来不会出现跨浏览器问题。我还有最新的FF,清除cookie会有什么帮助,我在脚本中添加了一个警报,以查看cookie是否正确找到,它确实找到了,当警报出现时,正确的数字会出现,然后在我确认警报时会被覆盖。我承认这是我第一次看到它使用过的Cookie,因此不完全熟悉它们的工作原理,尽管从我迄今为止的研究来看,它们非常简单。但是,我会尝试这样做。我尝试在测试之前删除所有Cookie,仍然没有任何区别,仍然会得到数量输入框中出现的随机数,其他人是否知道为什么应该这样做ccur以及为什么仅在某些浏览器上。
<script language="JavaScript" type="text/javascript">
        function click_a15a0ae39a4f7743373515e1d658d1c7(aform_reference) {
            var aform = aform_reference;
            aform['amount'].value = Math.round(aform['amount'].value * Math.pow(10, 2)) / Math.pow(10, 2);
            aform['custom_quantity'].value = aform['custom_quantity'].value.replace(/^\s+|\s+$/g, "");
            if (!aform['custom_quantity'].value || 0 === aform['custom_quantity'].value.length || /^\s*$/.test(aform['custom_quantity'].value)) {
                alert('A quantity is required');
                return false;
            } aform['amount'].value *= parseInt(aform['custom_quantity'].value);
        }
</script>
<form action="https://www.payfast.co.za/eng/process" name="form_a15a0ae39a4f7743373515e1d658d1c7" onsubmit="return click_a15a0ae39a4f7743373515e1d658d1c7( this );" method="post">
    <input type="hidden" name="cmd" value="_paynow">
    <input type="hidden" name="receiver" value="10479125">
    <input type="hidden" name="item_name" value="Rubydrops">
    <input type="hidden" name="amount" value="219.00">
    <input type="hidden" name="item_description" value="">
    <input type="hidden" name="return_url" value="http://www.rubydrops.co.za/_confirmation_contact.html">
    <input type="hidden" name="cancel_url" value="http://www.rubydrops.co.za/_order_cancellation.html">
    <table style="width:90%;margin:0.5em auto;">
        <tr><td align="right"><font color="red">*</font>&nbsp;<b>Quantity</b></td><td><input type="text" name="custom_quantity" id="qty" value="1"></td></tr>
        <tr>
            <td colspan=2 align=center><input type="image" src="https://www.payfast.co.za/images/buttons/light-small-buynow.png" width="165" height="36" alt="Buy Now" title="Buy Now with  PayFast"></td>
        </tr>
    </table>
</form>