xajax 并选择
我使用 XAJAX 创建了一些简单的内容,它用 php 脚本创建的一些选项替换了选择控件的内部 HTML。
这在 Firefox 中很好用,但在 IE7 中不起作用。
查看 XAJAX 论坛,我发现 this 基本上说“在 IE 中不起作用” ,使用 div 并将其内部 HTML 替换为完整的 select 语句”
这样做了,一切都很好,只是我有一个 jQuery 选择器在选择控件上工作,但现在它不再工作了。
任何人有任何想法,或者任何人都可以向我指出一个很好的 jQuery 示例,说明如何使用 jQuery 执行 ajax 位,这样我就可以完全放弃 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 调用替换时,问题就出现了
I have a bit of simple created with XAJAX, which replaces the innner HTML of a select control with some options created by a php script.
This is fine and dandy in Firefox, but it does not work in IE7.
Looking on the XAJAX forums i found this which basically says " doesnt really work in IE, use a div and replace the inner HTML of that with the full select statement"
Did this, and it's fine, except that i had a jQuery selector working on the select control, which now no longer works.
Anyone got any ideas, or can anyone point me to a good jQuery example of how to do the ajax bit using jQuery, so I can ditch the XAJAX altogether?
EDIT:
<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>
The problem comes when the contents of the imgselect
div
is replaced by the AJAX call
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了这个问题。
现在使用命令
为了完整起见,如果有人想在将来看到,我将原始页面设置为上面:
然后在我的 xajax php 文件中
This is now solved using the
command
For the sake of completeness and if anyone wants to see in the future, I have the original page set up as above:
then in my xajax php file I have