0
我试图建立对飞A HREF将它传递到的fancybox iframe和链路传递到一个PHP文件传递一个动态的href到的fancybox的iFrame
<script type="text/javascript">
jQuery(document).ready(function($){
$('a').each(function(){
var Href = 'GetImg.php?img=' + $(this).attr("href");
alert ("Href");
$(".Images").click(function() {
$.fancybox.open({
href : Href,
type : 'iframe',
padding : 5
});
});
};
}) ; // ready
</script>
HREF被设定即警报(” Href“)并传入php文件,但不在iframe中打开。 如果我硬代码
href : 'GetImg.php?img=/images/myImg.jpg' it works
我的链接
<a class="Images" href="/images/myImg.jpg" title="A witty Title">Send to PHP</a>
FYI这是GetImg.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title>Holly Gibbons</title>
<script type="text/javascript" src="fancyBox-2.0.6/lib/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/ddpowerzoomer.js"></script>
<script type="text/javascript">
jQuery(function($){
$('#image3').addpowerzoom({
defaultpower: 2,
powerrange: [2,5],
largeimage: null,
magnifiersize: [100,100] //<--no comma following last option!
});
});
</script>
</head>
<body>
<?php
$my_img = $_GET['img'];
?>
<p> <img id="image3" src = <?php echo $my_img ?> /></p>
</body>
</html>
你好吗确定选择器'$('a> img')'? 'img'标签似乎不在那里(在'a'标签内)。 –
不,这是一个错字&我编辑 – Holly
而'alert(“Href”);'只是打印字符串'Href'。 –