D
D
danyfir2019-01-28 21:24:00
JavaScript
danyfir, 2019-01-28 21:24:00

How to make a function call in Internet Explorer?

Here's the code. Works everywhere except IE. The site has many visitors from this browser. Judging by the console, IE does not even understand that the Selected(this) function is being called. Maybe this doesn't read?

<script>
                                function Selected(a) {
                                var label = a.value;
                                if (label=='Победитель (1 место)') {
                                document.getElementById('Block').innerHTML = 'Стоимость диплома: 120 руб.';
                                document.querySelectorAll('#cena').forEach((el) => el.value = '120');
                                } 
                                else if (label=='Победитель (2 место)') {
                                document.getElementById('Block').innerHTML = 'Стоимость диплома: 110 руб.';
                                document.querySelectorAll('#cena').forEach((el) => el.value = '110');
                                }
                                else if (label=='Победитель (3 место)') {
                                document.getElementById('Block').innerHTML = 'Стоимость диплома: 100 руб.';
                                document.querySelectorAll('#cena').forEach((el) => el.value = '100');
                                } 
                                else if (label=='Участник') {
                                document.getElementById('Block').innerHTML = 'Стоимость диплома: 29 руб.';
                                document.querySelectorAll('#cena').forEach((el) => el.value = '29');
                                alert('Участник'); 
                                } 
                                }
                                </script>

<select required name="user_status" id="user_status" onChange="Selected(this)">
                            <option class="cvet" value="" disabled="" selected="">Место</option>
                            <option value="Победитель (1 место)">1 место (120 руб.)</option>
                            <option value="Победитель (2 место)">2 место (110 руб.)</option>
                            <option value="Победитель (3 место)">3 место (100 руб.)</option>
                            <option value="Участник">Участник (29 руб.)</option>
                            </select>
                            
                            <div id='Block'>Стоимость диплома: 29 руб.</div>
                            
                            <form method="POST" class="application" accept-charset="UTF-8" action="https://paymaster.ru/payment/init">
                            <input type="hidden" name="LMI_MERCHANT_ID" value="klm32klm-23lmk23klm"/>
                            <input type="hidden" id="cena" name="LMI_PAYMENT_AMOUNT" value="100" />
                            <input type="hidden" name="LMI_CURRENCY" value="RUB" />     
                            <input type="hidden" name="LMI_PAYMENT_METHOD" value="BankCard" />
                            <input type="submit" value="Оплатить">
                            </form>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
titelhalter, 2019-01-29
@titelhalter

If you don't use faucets but paste the code directly into the page, then it doesn't work because IE doesn't support arrow functions .

D
danyfir, 2019-01-29
@danyfir

Solved the problem. The catch was:
IE did not accept these lines.
Replaced with
And shorter and easier it turned out. Didn't know about the asterisk before id. Thanks to all the "experts"...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question