2

XAJAXで作成した簡単なものがあります。これは、selectコントロールの内部HTMLをphpスクリプトで作成されたいくつかのオプションに置き換えます。

これはFirefoxでは問題なくダンディですが、IE7では機能しません。

XAJAXフォーラムを見ると、基本的に「IEでは実際には機能しません。divを使用し、その内部HTMLを完全なselectステートメントに置き換えてください」と書かれていることがわかりました。

これを実行しましたが、選択コントロールで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 divAJAX呼び出しに置き換えられたときに発生します

4

1 に答える 1

0

これは現在、

$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;
}
于 2009-03-25T12:29:34.533 に答える