【发布时间】:2011-01-28 15:25:49
【问题描述】:
我有一个使用 AJAX 在服务器端构建的 html 表。这个 html 表格是使用 prettyphoto 显示的,直到这里一切正常。但是表格的最后一列是一个链接,它调用一个应该使用漂亮照片打开的图像,但是这个链接不像我预期的那样工作。它打开没有漂亮照片的图像。请看下面的代码:
--> 使用AJAX打开prettyphoto里面的表格的函数
函数 myJS(myVar){
如果 (window.XMLHttpRequest){
xmlhttp=新的 XMLHttpRequest();}
否则{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
var description = xmlhttp.responseText;
$.prettyPhoto.open('#inline-1',myVar, 描述);
}
}
xmlhttp.open("GET","return_form.php?q="+escape(myVar),true);
xmlhttp.send();
}
//这里是prettyphoto使用的div
<div id="inline-1" class="hide"></div>
-----> 设置漂亮照片的方式
$(document).ready(function(){
$.fn.prettyPhoto();
$("a[rel^='prettyPhoto']").prettyPhoto();
});
--> 我在父prettyphoto 中的ajax 返回的表中再次调用prettyphoto 的方式,这是行不通的。当我点击链接时,它以正常方式打开,没有漂亮的照片
<td><a href='Habilitacao.jpg' rel='prettyPhoto' title='This is the description'><img src='nf_logo.jpg' width='30' height='30' alt='This is the title' /></a></td>
会很好,如果表格中的链接在下一个窗口中打开图像并且当我单击打开图像的上一个按钮时,它将返回到第一个我有很多链接的表格.
或者如果第一个选项不可能,只需使用 prettyphoto 在另一个窗口中打开链接,当我关闭图像窗口时,我可以返回表格窗口,其中每一行都有一个链接。
谢谢,
【问题讨论】:
标签: php javascript ajax jquery-plugins jquery