2017-12-05 7 views
0

이 웹 사이트에서 신용 카드 번호의 값을 설정하고 있는데 알아낼 수 없습니다. 양식이 iFrame 내부에 있으며 액세스 할 수 없다고 들었습니다. 콘솔을 통해 카드 번호의 값을 어떻게 설정합니까? 나는 다른 자동 채우기가 성공적으로 이것을 성공적으로 수행하는 것을 보았습니다. 고맙습니다. 내 콘솔에서Javascript : iFrame 내부에서 Form의 Value가 작동하지 않습니다.

난 그냥이 오류가 점점 계속 : 그렇게된다면이 크로스 도메인 문제가되지 않습니다 가정

VM531:3 Uncaught TypeError: Cannot set property 'value' of null at :3:11

enter image description here

var numb = document.getElementById('number'); 
 
numb.value = "222";
<iframe class="card-fields-iframe" id="card-fields-number-s80xmtdp1g000000" name="card-fields-number-s80xmtdp1g000000" scrolling="no" src="https://checkout.shopifycs.com/number?identifier=61d81845e21cfa9cd0cc2e43a6a8c9a1&amp;location=https%3A%2F%2Fyeezysupply.com%2F17655971%2Fcheckouts%2F61d81845e21cfa9cd0cc2e43a6a8c9a1%3F_ga%3D2.37031328.1462446110.1512281869-2081311403.1511598208" style="height: 43px;" frameborder="0"></iframe> 
 

 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0, height=device-height, minimum-scale=1.0, user-scalable=0"> 
 
    <link rel="stylesheet" media="all" href="https://checkout.shopifycs.com/build/inputs-2762b8ff87.css"> 
 
    
 
    </head> 
 
    <body> 
 
    <form> 
 
     
 
     <label for="number" class="visually-hidden" aria-hidden="true">Credit Card Number</label> 
 

 
     
 
      <input autocomplete="cc-number" id="number" name="number" aria-describedby="error-for-number tooltip-for-number" data-current-field="number" class="input-placeholder-color--lvl-30" style="color: rgb(171, 171, 171); font-family: Helvetica\ Neue, sans-serif; padding: 0.94em 0.8em; transition: padding 0.2s ease-out 0s;" placeholder="Card number" type="tel"> 
 
      <span id="error-for-number" class="input-error-message visually-hidden"></span> 
 
     
 
     
 
     <label for="name" class="visually-hidden" aria-hidden="true">Name on card</label> 
 

 
     
 
      <input autocomplete="cc-name" id="name" name="name" class="visually-hidden" aria-hidden="true" data-honeypot-field="" tabindex="-1" type="text"> 
 
     
 
     
 
     <label for="expiry_month" class="visually-hidden" aria-hidden="true">Expiry month</label> 
 

 
     
 
      <input autocomplete="cc-exp-month" id="expiry_month" name="expiry_month" class="visually-hidden" aria-hidden="true" data-honeypot-field="" tabindex="-1" type="tel"> 
 
     
 
     
 
     <label for="expiry_year" class="visually-hidden" aria-hidden="true">Expiry year</label> 
 

 
     
 
      <input autocomplete="cc-exp-year" id="expiry_year" name="expiry_year" class="visually-hidden" aria-hidden="true" data-honeypot-field="" tabindex="-1" type="tel"> 
 
     
 
     
 
     <label for="expiry" class="visually-hidden" aria-hidden="true">MM/YY</label> 
 

 
     
 
      <input autocomplete="cc-exp" id="expiry" name="expiry" class="visually-hidden" aria-hidden="true" data-honeypot-field="" tabindex="-1" type="tel"> 
 
     
 
     
 
     <label for="verification_value" class="visually-hidden" aria-hidden="true">CVV</label> 
 

 
     
 
      <input autocomplete="off" id="verification_value" name="verification_value" class="visually-hidden" aria-hidden="true" data-honeypot-field="" tabindex="-1" type="tel"> 
 
     
 
     
 
     <label for="issue_date" class="visually-hidden" aria-hidden="true">Issue date (MM/YY)</label> 
 

 
     
 
      <input autocomplete="off" id="issue_date" name="issue_date" class="visually-hidden" aria-hidden="true" data-honeypot-field="" tabindex="-1" type="tel"> 
 
     
 
     
 
     <label for="issue_number" class="visually-hidden" aria-hidden="true">Issue number</label> 
 

 
     
 
      <input autocomplete="off" id="issue_number" name="issue_number" class="visually-hidden" aria-hidden="true" data-honeypot-field="" tabindex="-1" type="tel"> 
 
     
 
     
 
     <button type="submit" class="visually-hidden" tabindex="-1"></button> 
 
    </form> 
 
    <script src="https://checkout.shopifycs.com/build/boot-6e4b6e821a.js"></script> 
 
    
 

 
</body>

+0

이 이전 질문으로이 같은 문제가되지 않습니다 https://stackoverflow.com/questions/47643224/javascript-having-trouble- 가치 설정하기 – Barmar

답변

0

을,이 시도 :

var element = $('#card-fields-iframe').contents().find('#number'); 
+0

크로스 도메인이기 때문에 어떻게해야합니까? – MGames

0

content() 방법을 사용할 수 있습니다.

var iframeBody = $('.card-fields-iframe').content().find('.body')

와의 요소의 취득 (수)

var numberField = iframeBody.find('#number'); 
//assign value to element 
numberField.value = "222";