문제

Xajax로 약간의 간단한 생성물이 있습니다.이 컨트롤의 Innner HTML을 PHP 스크립트로 만든 일부 옵션으로 대체합니다.

이것은 Firefox에서는 괜찮고 멍청하지만 IE7에서는 작동하지 않습니다.

내가 찾은 Xajax 포럼을보고 있습니다 이것 기본적으로 "IE에서 실제로 작동하지 않으며, div를 사용하고, 그것의 내부 HTML을 전체 선택 문으로 바꾸는 것"이라고 말합니다.

이것을했는데, jQuery 선택기가 선택 제어에서 작업한다는 점을 제외하고는 더 이상 작동하지 않습니다.

누구든지 아이디어를 얻었거나 누군가가 jQuery를 사용하여 Ajax 비트를 수행하는 방법에 대한 좋은 jQuery 예를 가리킬 수 있으므로 Xajax를 완전히 버릴 수 있습니까?


편집하다:

<div id=imgselect>
  <select id="images">
   <option value="">Then select an image</option>
  </select>
</div>


Picture Preview:<br><br>

 <div class="img-preview" id='preview'></div>
 <script type='text/javascript'>
   $('#images').change(function() 
   {
     var image = $(this).val();
     var img = $('<img/>').attr('src', image);
    $('#preview').html(img);

    document.getElementById('picsmall').value = image;
    });
</script>

문제는 내용이 발생할 때 발생합니다 imgselect div Ajax 호출로 대체됩니다

도움이 되었습니까?

해결책

이것은 이제 그것을 사용하여 해결되었습니다

$objResponse->script

명령

완전성을 위해, 그리고 누군가가 앞으로보고 싶다면, 나는 오리지널 페이지가 위와 같이 설정되어 있습니다.

<div id=imgselect>
  <select id="images">
    <option value="">Then select an image</option>
  </select>
</div>

그런 다음 xajax php 파일에서 나는 가지고 있습니다

function getphotos()
{
    $objResponse = new xajaxResponse();
        //this include assigns all the options to the select controll into the $output var
    include "photos.photosselect.php";
    $objResponse->assign("imgselect", "innerHTML", "$output");
    $objResponse->script("$('#images').change(function() {var image = $(this).val(); var img = $('<img/>').attr('src', image); $('#preview').html(img); document.getElementById('picsmall').value = image;});");
    return $objResponse;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top