0

스크립트 기능과 랩톱에서 작동하지만 모바일에서는 호출하지 않습니다 (Android에만 확인). 간단한 경고 메시지를 표시하지 않습니다.자바 스크립트 기능이 모바일에서 호출하지 않습니다.

어떤 이유가있을 수 있습니까?

다음
<a href="javascript:void(0)" 
       onclick="doit(id='<?php echo $results[$i]->ID; ?>', color = '<?php echo get_post_meta($pid, 'color', true);?>',color2='<?php echo get_post_meta($pid, 'color2', true);?>', 
        unit_size='<?php echo get_post_meta($pid, 'unit_size', true);?>', unit_size2='<?php echo get_post_meta($pid, 'unit_size2', true);?>',col_unit_gst='<?php echo get_post_meta($pid, 'col_unit_gst', true);?>', 
        col_unit_Xgst='<?php echo get_post_meta($pid, 'col_unit_Xgst', true);?>',col2_unit2_Xgst='<?php echo get_post_meta($pid, 'col2_unit2_Xgst', true);?>', 
        col2_unit2_gst='<?php echo get_post_meta($pid, 'col2_unit2_gst', true);?>')" value="<?php echo $results[$i]->ID;?>" class="mycls<?php echo $pid;?>"><button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">For Price</button></a> 

이 기능을 만들어

  <!-- Modal content--> 
      <div class="modal-content"> 
       <div class="modal-header"> 
        <button type="button" class="close" data-dismiss="modal">&times;</button> 
        <h4 class="modal-title">Price List</h4> 
       </div> 
       <div class="modal-body"> 
        <script language="JavaScript"> 
         function doit (id='', color = '',color2='', unit_size='', unit_size2='',col_unit_gst='', col_unit_Xgst='', 
             col2_unit2_Xgst='', col2_unit2_gst=''){ 

          alert('Yes we are here'); 
          document.getElementById('color').innerHTML = color; 
          document.getElementById('unit_size').innerHTML = unit_size; 
          document.getElementById('col_unit_gst').innerHTML = col_unit_gst; 
          document.getElementById('col_unit_Xgst').innerHTML = col_unit_Xgst; 

          /* document.getElementById('id').innerHTML = id; */ 
          document.getElementById('color2').innerHTML = color2; 
          document.getElementById('unit_size2').innerHTML = unit_size2; 
          document.getElementById('col2_unit2_Xgst').innerHTML = col2_unit2_Xgst; 
          document.getElementById('col2_unit2_gst').innerHTML = col2_unit2_gst; 

         } 
        </script> 


       <div class="ratelist-heading"> 
       <ul class="head"> 
       <li>Colour 
       </li> 
       <li>Unit Size 
       </li> 
       <li>ex.GST 
       </li> 
       <li>Incl.GST 
       </li> 
       </ul> 

       <ul class="ratelist"> 
       <li><p style="float: none;" id="color"></p> <p style="float: none;" id="color2"></p></li> 
       <li><p style="float: none;" id="unit_size"></p> <p style="float: none;" id="unit_size2"></p></li> 
       <li><p style="float: none;" id="col_unit_Xgst"></p> <p style="float: none;" id="col2_unit2_Xgst"></p></li> 
       <li><p style="float: none;" id="col_unit_gst"></p> <p style="float: none;" id="col2_unit2_gst"></p></li> 
       </ul> 


       </div> 


       </div> 
       <div class="modal-footer"> 
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> 
       </div> 
      </div> 

     </div> 
    </div> 

업데이트 : 이것은 또한 인터넷 익스플로러 11에서 작동하지 않는 브라우저 호환성 문제로 보인다

이 링크입니다.

+0

충분한 정보를 제공하지 않으면 도움을 드릴 수 없습니다 –

+0

코드는 어디에 있습니까? – brk

+0

코드가 추가되고 게시 됨 – Jai

답변

0

나는 오류를 찾아 낸다. 여기에 내가 만든 어떤 변화 :

      function doit (id, color,color2, unit_size, unit_size2,col_unit_gst, col_unit_Xgst, 
             col2_unit2_Xgst, col2_unit2_gst) 

을 이전에 내가로 통과했다 : 이것은 "인터넷 익스플로러 11"에서 작업 또한 모바일 장치에서 같은 문제가되지 않았다

function doit (id='', color = '',color2='', unit_size='', unit_size2='',col_unit_gst='', col_unit_Xgst='', 
            col2_unit2_Xgst='', col2_unit2_gst='') 

. 그것의 고정 지금.

감사합니다.

0

휴대 전화 브라우저에서 JavaScript가 허용되는지 확인 했습니까? 설정으로 이동하여 JavaScript가 허용되는지 확인하십시오. 그렇지 않으면 코드를 재생할 수 없습니다.

+0

모든 모바일에서 사용하도록 설정할 수 있으므로 기본적으로 작동합니다. – Jai

+0

@Jai USB를 통해 Android 휴대 전화를 디버깅 해 보셨습니까? 쉬운 튜토리얼을 따라 USB 디버깅을 설정 한 다음 컴퓨터의 chrome dev 도구를 사용하여 휴대 전화에서 실행중인 코드를 진단 할 수 있습니다. 이렇게하면 JavaScript 오류를 검사하거나 코드를 한 줄씩 살펴볼 수 있습니다. –

+0

어떻게하는 ..? – Jai

관련 문제