题
我有一个比特的简单与xajax的创建,它取代一个选择控制与由PHP脚本创建的一些选项的肠子HTML
这是非常愉快的Firefox,但它不能在IE7工作。
找上了xajax的论坛上,我发现这基本上说,“并没有真正在IE中,使用一个div并与全选择语句“
的取代,内HTML这样做,和它的罚款,但我有一个jQuery选择的选择控制,现在不再有效的工作。
任何人有任何想法,或任何人都可以点我怎么做使用jQuery阿贾克斯位的好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;
}
不隶属于 StackOverflow